- Go 96.8%
- Shell 2%
- Makefile 1.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Support specifying a directory as the path value of the `-M` flag, just like the `-o` flag. |
||
| docs | ||
| scripts | ||
| .gitignore | ||
| conversion.go | ||
| cookies.go | ||
| cookies_test.go | ||
| go.mod | ||
| LICENSE | ||
| main.go | ||
| main_test.go | ||
| Makefile | ||
| manifest.go | ||
| README.md | ||
ugoira-tool
Downloader and converter for Pixiv's Ugoira animation format.
Dependencies
Internal
- Only Go's standard library.
External
- (Optional) FFmpeg: for Ugoira to video conversion.
Usage
Downloading a Ugoira
$ ugoira-tool download <post_id>
Using a specific file name:
$ ugoira-tool download -o ugo.zip <post_id>
By default, it will download both the zip file (containing the frames) and the manifest JSON in the current
working directory (default filenames being <post_id>_ugoira.zip and <post_id>_ugoira.json respectively).
Use -o to change the zip file path and -M for the manifest. Both flags accept either a file path or an
existing directory. If the path points to a directory, the default filename is used in that directory:
<post_id>_ugoira.zip for -o and <post_id>_ugoira.json for -M. A path that does not already exist is
treated as a file path.
When -M is omitted, the manifest is saved alongside the zip file, including when -o specifies another
directory.
For ugoira requiring a Pixiv account (NSFW), use -C to provide a cookie file exported in the Netscape HTTP
cookie file format:
$ ugoira-tool download -C pixiv-cookies.txt <post_id>
The cookie file should preferably contain only Pixiv cookies. Cookie files containing cookies for other sites are supported, but are not recommended. If the file cannot be read or contains malformed entries, the download fails before making any requests.
Expired cookie records are skipped with a warning; if the request fails it means that you need a new set of cookies.
For extracting cookies from your browser, use addon such as cookies.txt for Firefox, or Get cookies.txt LOCALLY for Chromium-based browsers.
Overriding the user agent
For convenience, ugoira-tool uses real browser UA (which is required for download with cookies), but this
default can be overridden using the -A flag:
$ ugoira-tool download -A 'my legit browser UA' ...
The user agent string must not be empty.
Conversion of Ugoira animation to WebM
$ ugoira-tool convert -o anim.webm <ugoira_file> <ugoira_manifest>
The created WebM file uses the VP9 codec with flags that should yield a decent quality while maintaining a reasonable file size, avoiding any additional quality degradation (since most Ugoira use JPEG for their frames).
The default FFmpeg arguments are defined in conversion.go.
You can set your own FFmpeg flags with the -ffmpeg-args flag.
Building
$ go build
License
This program is licensed under the Mozilla Public License 2.0.