No description
  • Go 96.8%
  • Shell 2%
  • Makefile 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
tocariimaa 115a51160d support directory path for download -M flag
Support specifying a directory as the path value of the `-M` flag, just
like the `-o` flag.
2026-08-22 00:12:55 -04:00
docs update ugoira.md 2026-08-20 18:41:02 -04:00
scripts add scripts/ 2026-08-20 18:08:00 -04:00
.gitignore add gitignore 2026-08-17 16:25:55 -04:00
conversion.go use errors.As() for error type checking 2026-08-21 16:43:53 -04:00
cookies.go implement cookie support 2026-08-18 17:30:12 -04:00
cookies_test.go implement cookie support 2026-08-18 17:30:12 -04:00
go.mod change module name 2026-08-17 17:55:09 -04:00
LICENSE change license to MPL 2.0 2026-08-20 18:43:41 -04:00
main.go support directory path for download -M flag 2026-08-22 00:12:55 -04:00
main_test.go support directory path for download -M flag 2026-08-22 00:12:55 -04:00
Makefile makefile: add test target 2026-08-21 18:11:27 -04:00
manifest.go move manifest error field check out 2024-12-31 13:56:35 -03:00
README.md support directory path for download -M flag 2026-08-22 00:12:55 -04:00

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.