116 lines
2.0 KiB
Markdown
116 lines
2.0 KiB
Markdown
# hitomi-downloader
|
|
|
|
A small Go command-line downloader for `hitomi.moe` galleries.
|
|
|
|
The tool fetches gallery metadata from `https://hitomi.moe/reader/info/<id>`,
|
|
writes it to `info.json`, and downloads all gallery images with concurrent
|
|
workers.
|
|
|
|
## Requirements
|
|
|
|
- Go 1.26 or newer
|
|
- Network access to `hitomi.moe`
|
|
|
|
## Build
|
|
|
|
```sh
|
|
go build -o hitomi-downloader .
|
|
```
|
|
|
|
## Usage
|
|
|
|
Download by gallery URL:
|
|
|
|
```sh
|
|
go run . -url https://hitomi.moe/g/123456
|
|
```
|
|
|
|
Download by gallery ID:
|
|
|
|
```sh
|
|
go run . -url 123456
|
|
```
|
|
|
|
The gallery identifier can also be provided as a positional argument:
|
|
|
|
```sh
|
|
go run . 123456
|
|
```
|
|
|
|
After building:
|
|
|
|
```sh
|
|
./hitomi-downloader -url 123456 -out downloads
|
|
```
|
|
|
|
## Options
|
|
|
|
```text
|
|
-url string
|
|
Hitomi gallery URL or ID.
|
|
|
|
-out string
|
|
Output directory. Defaults to "downloads".
|
|
|
|
-workers int
|
|
Number of concurrent download workers. Defaults to a value based on CPU
|
|
count, with a minimum of 2 and a maximum of 8.
|
|
|
|
-timeout int
|
|
Per-request timeout in seconds. Defaults to 30.
|
|
|
|
-skip-existing bool
|
|
Skip existing non-empty files. Defaults to true.
|
|
Use -skip-existing=false to force re-downloads.
|
|
|
|
-metadata-only bool
|
|
Fetch metadata and write info.json without downloading images.
|
|
```
|
|
|
|
## Output
|
|
|
|
Files are written under:
|
|
|
|
```text
|
|
<out>/<gallery-id>_<sanitized-title>/
|
|
```
|
|
|
|
Each gallery directory contains:
|
|
|
|
```text
|
|
info.json
|
|
001.<ext>
|
|
002.<ext>
|
|
003.<ext>
|
|
...
|
|
```
|
|
|
|
Images are first downloaded to a temporary `.part` file and then renamed into
|
|
place when the download completes successfully.
|
|
|
|
## Examples
|
|
|
|
Fetch metadata only:
|
|
|
|
```sh
|
|
go run . -url 123456 -metadata-only
|
|
```
|
|
|
|
Use more workers and a longer timeout:
|
|
|
|
```sh
|
|
go run . -url 123456 -workers 12 -timeout 60
|
|
```
|
|
|
|
Force re-downloading existing files:
|
|
|
|
```sh
|
|
go run . -url 123456 -skip-existing=false
|
|
```
|
|
|
|
## Notes
|
|
|
|
Use this tool responsibly and follow the terms and rules of the site you are
|
|
accessing. Very high worker counts can increase load on the remote server and
|
|
may make downloads less reliable.
|