v2 update

This commit is contained in:
bytedream 2022-03-22 19:39:55 +01:00
parent b239353039
commit c367636d96
3 changed files with 177 additions and 265 deletions

View file

@ -1,4 +1,4 @@
VERSION=1.2.4 VERSION=2.0.0
BINARY_NAME=crunchy BINARY_NAME=crunchy
VERSION_BINARY_NAME=$(BINARY_NAME)-v$(VERSION) VERSION_BINARY_NAME=$(BINARY_NAME)-v$(VERSION)
@ -21,13 +21,10 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/crunchyroll-go.1 rm -f $(DESTDIR)$(PREFIX)/share/man/man1/crunchyroll-go.1
rm -f $(DESTDIR)$(PREFIX)/share/licenses/crunchyroll-go/LICENSE rm -f $(DESTDIR)$(PREFIX)/share/licenses/crunchyroll-go/LICENSE
test:
go test -v .
release: release:
cd cmd/crunchyroll-go && GOOS=linux GOARCH=amd64 go build -o $(VERSION_BINARY_NAME)_linux cd cmd/crunchyroll-go && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(VERSION_BINARY_NAME)_linux
cd cmd/crunchyroll-go && GOOS=windows GOARCH=amd64 go build -o $(VERSION_BINARY_NAME)_windows.exe cd cmd/crunchyroll-go && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $(VERSION_BINARY_NAME)_windows.exe
cd cmd/crunchyroll-go && GOOS=darwin GOARCH=amd64 go build -o $(VERSION_BINARY_NAME)_darwin cd cmd/crunchyroll-go && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(VERSION_BINARY_NAME)_darwin
strip cmd/crunchyroll-go/$(VERSION_BINARY_NAME)_linux strip cmd/crunchyroll-go/$(VERSION_BINARY_NAME)_linux

307
README.md
View file

@ -1,10 +1,8 @@
**This branch is under highly development, so it may contain errors which are making compiling not possible** <p align="center"><strong>Version 2 is out 🥳, see all the <a href="https://github.com/ByteDream/crunchyroll-go/releases/tag/v2.0.0">changes.</a></strong></p>
# crunchyroll-go # crunchyroll-go
A [Go](https://golang.org) library & cli for the undocumented [crunchyroll](https://www.crunchyroll.com) api. A [Go](https://golang.org) library & cli for the undocumented [crunchyroll](https://www.crunchyroll.com) api. To use it, you need a crunchyroll premium account to for full (api) access.
**You surely need a crunchyroll premium account to get full (api) access.**
<p align="center"> <p align="center">
<a href="https://github.com/ByteDream/crunchyroll-go"> <a href="https://github.com/ByteDream/crunchyroll-go">
@ -32,20 +30,22 @@ A [Go](https://golang.org) library & cli for the undocumented [crunchyroll](http
<a href="#-library">Library 📚</a> <a href="#-library">Library 📚</a>
<a href="#-credits">Credits 🙏</a> <a href="#%EF%B8%8F-disclaimer">Disclaimer ☝️</a>
<a href="#-notice">Notice 🗒️</a>
<a href="#-license">License ⚖</a> <a href="#-license">License ⚖</a>
</p> </p>
## 🖥️ CLI # 🖥️ CLI
#### ✨ Features ## ✨ Features
- Download single videos and entire series from [crunchyroll](https://www.crunchyroll.com)
#### Get the executable - Download single videos and entire series from [crunchyroll](https://www.crunchyroll.com).
- 📥 Download the latest binaries [here](https://github.com/ByteDream/crunchyroll-go/releases/latest) or get it from below - Archive episode or seasons in an `.mkv` file with multiple subtitles and audios and compress them to gzip or zip files.
- Specify a range which episodes to download from an anime.
## 💾 Get the executable
- 📥 Download the latest binaries [here](https://github.com/ByteDream/crunchyroll-go/releases/latest) or get it from below:
- [Linux (x64)](https://smartrelease.bytedream.org/github/ByteDream/crunchyroll-go/crunchy-{tag}_linux) - [Linux (x64)](https://smartrelease.bytedream.org/github/ByteDream/crunchyroll-go/crunchy-{tag}_linux)
- [Windows (x64)](https://smartrelease.bytedream.org/github/ByteDream/crunchyroll-go/crunchy-{tag}_windows.exe) - [Windows (x64)](https://smartrelease.bytedream.org/github/ByteDream/crunchyroll-go/crunchy-{tag}_windows.exe)
- [MacOS (x64)](https://smartrelease.bytedream.org/github/ByteDream/crunchyroll-go/crunchy-{tag}_darwin) - [MacOS (x64)](https://smartrelease.bytedream.org/github/ByteDream/crunchyroll-go/crunchy-{tag}_darwin)
@ -67,9 +67,13 @@ A [Go](https://golang.org) library & cli for the undocumented [crunchyroll](http
$ go build -o crunchy $ go build -o crunchy
``` ```
### 📝 Examples ## 📝 Examples
_Before reading_: Because of the huge functionality not all cases can be covered in the README.
Make sure to check the [wiki](https://github.com/ByteDream/crunchyroll-go/wiki/Cli), further usages and options are described there.
### Login
#### Login
Before you can do something, you have to login first. Before you can do something, you have to login first.
This can be performed via crunchyroll account email and password. This can be performed via crunchyroll account email and password.
@ -82,11 +86,9 @@ or via session id
$ crunchy login --session-id 8e9gs135defhga790dvrf2i0eris8gts $ crunchy login --session-id 8e9gs135defhga790dvrf2i0eris8gts
``` ```
#### Download ### Download
**With the cli you can download single videos or entire series.** By default, the cli tries to download the episode with your system language as audio.
By default the cli tries to download the episode with your system language as audio.
If no streams with your system language are available, the video will be downloaded with japanese audio and hardsubbed subtitles in your system language. If no streams with your system language are available, the video will be downloaded with japanese audio and hardsubbed subtitles in your system language.
**If your system language is not supported, an error message will be displayed and en-US (american english) will be chosen as language.** **If your system language is not supported, an error message will be displayed and en-US (american english) will be chosen as language.**
@ -95,7 +97,6 @@ $ crunchy download https://www.crunchyroll.com/darling-in-the-franxx/episode-1-a
``` ```
With `-r best` the video(s) will have the best available resolution (mostly 1920x1080 / Full HD). With `-r best` the video(s) will have the best available resolution (mostly 1920x1080 / Full HD).
``` ```
$ crunchy download -r best https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575 $ crunchy download -r best https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575
``` ```
@ -105,250 +106,106 @@ The file is by default saved as a `.ts` (mpeg transport stream) file.
With the `-o` flag, you can change the name (and file ending) of the output file. With the `-o` flag, you can change the name (and file ending) of the output file.
So if you want to save it as, for example, `mp4` file, just name it `whatever.mp4`. So if you want to save it as, for example, `mp4` file, just name it `whatever.mp4`.
**You need [ffmpeg](https://ffmpeg.org) to store the video in other file formats.** **You need [ffmpeg](https://ffmpeg.org) to store the video in other file formats.**
``` ```
$ crunchy download -o "daaaaaaaaaaaaaaaarling.ts" https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575 $ crunchy download -o "daaaaaaaaaaaaaaaarling.ts" https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575
``` ```
With the `--audio` flag you can specify which audio the video should have and with `--subtitle` which subtitle it should have. With the `--audio` flag you can specify which audio the video should have and with `--subtitle` which subtitle it should have.
Type `crunchy help download` to see all available locales. Type `crunchy help download` to see all available locales.
``` ```
$ crunchy download --audio ja-JP --subtitle de-DE https://www.crunchyroll.com/darling-in-the-franxx $ crunchy download --audio ja-JP --subtitle de-DE https://www.crunchyroll.com/darling-in-the-franxx
``` ```
##### Flags ##### Flags
- `--audio` » forces audio of the video(s)
- `--subtitle` » forces subtitle of the video(s)
- `--no-hardsub` » forces that the subtitles are stored as a separate file and are not directly embedded into the video
- `--only-sub` » downloads only the subtitles without the corresponding video
- `-d`, `--directory` » directory to download the video(s) to The following flags can be (optional) passed to modify the [download](#download) process.
- `-o`, `--output` » name of the output file
- `-r`, `--resolution` » the resolution of the video(s). `best` for best resolution, `worst` for worst | Short | Extended | Description |
|-------|----------------|--------------------------------------------------------------------------------|
| `-a` | `--audio` | Forces audio of the video(s). |
| `-s` | `--subtitle` | Forces subtitle of the video(s). |
| `-d` | `--directory` | Directory to download the video(s) to. |
| `-o` | `--output` | Name of the output file. |
| `-r` | `--resolution` | The resolution of the video(s). `best` for best resolution, `worst` for worst. |
| `-g` | `--goroutines` | Sets how many parallel segment downloads should be used. |
- `--alternative-progress` » shows an alternative, not so user-friendly progress instead of the progress bar ### Archive
- `-g`, `--goroutines` » sets how many parallel segment downloads should be used Archive works just like [download](#download). It downloads the given videos as `.mkv` files and stores all (soft) subtitles in it.
Default audio locales are japanese and your system language (if available) but you can set more or less with the `--language` flag.
Archive a file
```shell
$ crunchy archive https://www.crunchyroll.com/darling-in-the-franxx/darling-in-the-franxx/episode-1-alone-and-lonesome-759575
```
Downloads the first two episode of Darling in the FranXX and stores it compressed in a file.
```shell
$ crunchy archive -c "ditf.tar.gz" https://www.crunchyroll.com/darling-in-the-franxx/darling-in-the-franxx
```
##### Flags
The following flags can be (optional) passed to modify the [archive](#archive) process.
| Short | Extended | Description |
|-------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `-l` | `--language` | Audio locale which should be downloaded. Can be used multiple times. |
| `-d` | `--directory` | Directory to download the video(s) to. |
| `-o` | `--output` | Name of the output file. |
| `-m` | `--merge` | Sets the behavior of the stream merging. Valid behaviors are 'auto', 'audio', 'video'. See the [wiki](https://github.com/ByteDream/crunchyroll-go/wiki/Cli#archive) for more information. |
| `-c` | `--compress` | If is set, all output will be compresses into an archive. This flag sets the name of the compressed output file and the file ending specifies the compression algorithm (gzip, tar, zip are supported). |
| `-r` | `--resolution` | The resolution of the video(s). `best` for best resolution, `worst` for worst. |
| `-g` | `--goroutines` | Sets how many parallel segment downloads should be used. |
### Help
#### Help
- General help - General help
``` ```shell
$ crunchy help $ crunchy help
``` ```
- Login help - Login help
``` ```shell
$ crunchy help login $ crunchy help login
``` ```
- Download help - Download help
``` ```shell
$ crunchy help download $ crunchy help download
``` ```
#### Global flags - Archive help
```shell
$ crunchy help archive
```
### Global flags
These flags you can use across every sub-command These flags you can use across every sub-command
- `-q`, `--quiet` » disables all output | Flag | Description |
- `-v`, `--verbose` » shows additional debug output |------|------------------------------------------------------|
- `--color` » adds color to the output (works only on not windows systems) | `-q` | Disables all output. |
| `-v` | Shows additional debug output. |
| `-p` | Use a proxy to hide your ip / redirect your traffic. |
- `-p`, `--proxy` » use a proxy to hide your ip / redirect your traffic # 📚 Library
- `-l`, `--locale` » the language to display video specific things like the title. default is your system language
## 📚 Library
Download the library via `go get` Download the library via `go get`
```shell
```
$ go get github.com/ByteDream/crunchyroll-go $ go get github.com/ByteDream/crunchyroll-go
``` ```
### 📝 Examples The documentation is available on [pkg.go.dev](https://pkg.go.dev/github.com/ByteDream/crunchyroll-go).
```go
func main() {
// login with credentials
crunchy, err := crunchyroll.LoginWithCredentials("user@example.com", "password", crunchyroll.US, http.DefaultClient)
if err != nil {
panic(err)
}
// finds a series or movie by a crunchyroll link Examples how to use the library and some features of it are described in the [wiki](https://github.com/ByteDream/crunchyroll-go/wiki/Library).
video, err := crunchy.FindVideo("https://www.crunchyroll.com/darling-in-the-franxx")
if err != nil {
panic(err)
}
series := video.(*crunchyroll.Series) # ☝️ Disclaimer
seasons, err := series.Seasons()
if err != nil {
panic(err)
}
fmt.Printf("Found %d seasons for series %s\n", len(seasons), series.Title)
// search `Darling` and return 20 results This tool is **ONLY** meant to be used for private purposes.
series, movies, err := crunchy.Search("Darling", 20) To use this tool you need crunchyroll premium anyway, so there is no reason why rip and share the episodes.
if err != nil {
panic(err)
}
fmt.Printf("Found %d series and %d movies for query `Darling`\n", len(series), len(movies))
}
```
```go **The responsibility for what happens to the downloaded videos lies entirely with the user who downloaded them.**
func main() {
crunchy, err := crunchyroll.LoginWithSessionID("8e9gs135defhga790dvrf2i0eris8gts", crunchyroll.US, http.DefaultClient)
if err != nil {
panic(err)
}
// returns an episode slice with all episodes which are matching the given url.
// the episodes in the returning slice differs from the underlying streams, but are all pointing to the first ditf episode
episodes, err := crunchy.FindEpisode("https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575")
if err != nil {
panic(err)
}
fmt.Printf("Found %d episodes\n", len(episodes))
}
```
<h4 align="center">Structure</h4>
Because of the apis structure, it can lead very fast much redundant code for simple tasks, like getting all episodes
with japanese audio and german subtitle. For this case and some other, the api has a utility called `Structure` in its utils.
```go
func main() {
crunchy, err := crunchyroll.LoginWithCredentials("user@example.com", "password", crunchyroll.US, http.DefaultClient)
if err != nil {
panic(err)
}
// search `Darling` and return 20 results (series and movies) or less
series, movies, err := crunchy.Search("Darling", 20)
if err != nil {
panic(err)
}
fmt.Printf("Found %d series and %d movies for search query `Darling`\n", len(series), len(movies))
seasons, err := series[0].Seasons()
if err != nil {
panic(err)
}
// in the crunchyroll.utils package, you find some structs which can be used to simplify tasks.
// you can recursively search all underlying content
seriesStructure := utils.NewSeasonStructure(seasons)
// this returns every format of all the above given seasons
formats, err := seriesStructure.Formats()
if err != nil {
panic(err)
}
fmt.Printf("Found %d formats\n", len(formats))
filteredFormats, err := seriesStructure.FilterFormatsByLocales(crunchyroll.JP, crunchyroll.DE, true)
if err != nil {
panic(err)
}
fmt.Printf("Found %d formats with japanese audio and hardsubbed german subtitles\n", len(filteredFormats))
// reverse sorts the formats after their resolution by calling a sort type which is also defined in the api utils
// and stores the format with the highest resolution in a variable
sort.Sort(sort.Reverse(utils.FormatsByResolution(filteredFormats)))
format := formats[0]
// get the episode from which the format is a child
episode, err := seriesStructure.FilterEpisodeByFormat(format)
if err != nil {
panic(err)
}
file, err := os.Create(fmt.Sprintf("%s.ts", episode.Title))
if err != nil {
panic(err)
}
// download the format to the file
if err := format.DownloadGoroutines(file, 4, nil); err != nil {
panic(err)
}
fmt.Printf("Downloaded %s with %s resolution and %.2f fps as %s\n", episode.Title, format.Video.Resolution, format.Video.FPS, file.Name())
// for more useful structure function just let your IDE's autocomplete make its thing
}
```
As you can see in the example above, most of the `crunchyroll.utils` Structure functions are returning errors. There is
a build-in functionality with are avoiding causing the most errors and let you safely ignore them as well.
**Note that errors still can appear**
```go
func main() {
crunchy, err := crunchyroll.LoginWithCredentials("user@example.com", "password", crunchyroll.US, http.DefaultClient)
if err != nil {
panic(err)
}
foundEpisodes, err := crunchy.FindEpisode("https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575")
if err != nil {
panic(err)
}
episodeStructure := utils.NewEpisodeStructure(foundEpisodes)
// this function recursively calls all api endpoints, receives everything and stores it in memory,
// so that after executing this, no more request to the crunchyroll server has to be made.
// note that it could cause much network load while running this method.
//
// you should check the InitAllState before, because InitAll could have been already called or
// another function has the initialization as side effect and re-initializing everything
// will change every pointer in the struct which can cause massive problems afterwards.
if !episodeStructure.InitAllState() {
if err := episodeStructure.InitAll(); err != nil {
panic(err)
}
}
formats, _ := episodeStructure.Formats()
streams, _ := episodeStructure.Streams()
episodes, _ := episodeStructure.Episodes()
fmt.Printf("Initialized %d formats, %d streams and %d episodes\n", len(formats), len(streams), len(episodes))
}
```
### Tests
You can also run test to see if the api works correctly.
Before doing this, make sure to either set your crunchyroll email and password or sessions as environment variable.
The email variable has to be named `EMAIL` and the password variable `PASSWORD`. If you want to use your session id, the variable must be named `SESSION_ID`.
You can run the test via `make`
```
$ make test
```
or via `go` directly
```
$ go test .
```
# 🙏 Credits
### [Kamyroll-Python](https://github.com/hyugogirubato/Kamyroll-Python)
- Extracted all api endpoints and the login process from this
### [m3u8](https://github.com/oopsguy/m3u8)
- Decrypting mpeg stream files
### All libraries
- [m3u8](https://github.com/grafov/m3u8) (not the m3u8 library from above) » mpeg stream info library
- [cobra](https://github.com/spf13/cobra) » cli library
# 🗒️ Notice
Sometimes the download stops without a reason on linux and does not go further. In this case the `tmpfs` / `/tmp` directory may be full. Execute `df /tmp` to see how much of the space is used.
I would really appreciate if someone rewrites the complete cli. I'm not satisfied with it's current structure but at the moment I have no time and no desire to do it myself.
# ⚖ License # ⚖ License
This project is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0) - see the [LICENSE](LICENSE) file This project is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0) - see the [LICENSE](LICENSE) file for more details.
for more details.

View file

@ -1,16 +1,18 @@
.TH crunchyroll-go 1 "13 September 2021" "crunchyroll-go" "Crunchyroll Downloader" .TH crunchyroll-go 1 "21 March 2022" "crunchyroll-go" "Crunchyroll Downloader"
.SH NAME .SH NAME
crunchyroll-go - A cli for downloading videos and entire series from crunchyroll. crunchyroll-go - A cli for downloading videos and entire series from crunchyroll.
.SH SYNOPSIS .SH SYNOPSIS
crunchyroll-go [\fB-h\fR] [\fB--color\fR] [\fB-p\fR \fIPROXY\fR] [\fB-q\fR] [\fB-v\fR] crunchyroll-go [\fB-h\fR] [\fB-p\fR \fIPROXY\fR] [\fB-q\fR] [\fB-v\fR]
.br .br
crunchyroll-go help crunchyroll-go help
.br .br
crunchyroll-go login [\fB--session-id\fR \fISESSION_ID\fR] [\fIemail\fR, \fIpassword\fR] crunchyroll-go login [\fB--persistent\fR] [\fB--session-id\fR \fISESSION_ID\fR] [\fIusername\fR, \fIpassword\fR]
.br .br
crunchyroll-go download [\fB--alternative-progress\fR] [\fB-a\fR \fILOCALE\fR] [\fB-d\fR \fIDIRECTORY\fR] [\fB--no-hardsub\fR] [\fB-o\fR \fIOUTPUT\fR] [\fB-r\fR \fIRESOLUTION\fR] [\fB-s\fR \fILOCALE\fR] \fIURL…\fR crunchyroll-go download [\fB-a\fR \fIAUDIO\fR] [\fB-s\fR \fISUBTITLE\fR] [\fB-d\fR \fIDIRECTORY\fR] [\fB-o\fR \fIOUTPUT\fR] [\fB-r\fR \fIRESOLUTION\fR] [\fB-g\fR \fIGOROUTINES\fR] \fIURLs...\fR
.br
crunchyroll-go archive [\fB-l\fR \fILANGUAGE\fR] [\fB-d\fR \fIDIRECTORY\fR] [\fB-o\fR \fIOUTPUT\fR] [\fB-m\fR \fIMERGE BEHAVIOR\fR] [\fB-c\fR \fICOMPRESS\fR] [\fB-r\fR \fIRESOLUTION\fR] [\fB-g\fR \fIGOROUTINES\fR] \fIURLs...\fR
.SH DESCRIPTION .SH DESCRIPTION
.TP .TP
@ -28,10 +30,6 @@ This options can be passed to every action.
Shows help. Shows help.
.TP .TP
\fB--color\fR
Shows the output in different colors which will make it easier to differ the output.
.TP
\fB-p, --proxy PROXY\fR \fB-p, --proxy PROXY\fR
Sets a proxy through which all traffic will be routed. Sets a proxy through which all traffic will be routed.
.TP .TP
@ -43,42 +41,40 @@ Disables all output.
\fB-v, --verbose\fR \fB-v, --verbose\fR
Shows verbose output. Shows verbose output.
.SH LOGIN OPTIONS .SH LOGIN COMMAND
This options can only be used when calling the \fIlogin\fR action. This command logs in to crunchyroll and stores the session id or credentials on the drive. This needs to be done before calling other commands since they need a valid login to operate.
.TP
\fB--persistent\fR
Stores the given credentials permanent on the drive. The *nix path for it is $HOME/.config/crunchy.
.br
NOTE: The credentials are stored in plain text and if you not use \fB--session-id\fR your credentials are used (if you not use the \fB--persistent\fR flag only a session id gets stored regardless if you login with username/password or a session id).
.TP .TP
\fB--session-id SESSION_ID\fR \fB--session-id SESSION_ID\fR
Login via a session id (which can be extracted from a crunchyroll browser cookie) instead of using email and password. Login via a session id (which can be extracted from a crunchyroll browser cookie) instead of using username and password.
.SH DOWNLOAD OPTIONS .SH DOWNLOAD COMMAND
This options can only be used when calling the \fIdownload\fR action. A command to simply download videos. The output file is stored as a \fI.ts\fR file. \fIffmpeg\fR has to be installed if you want to change the format the videos are stored in.
.TP .TP
\fB--alternative-progress\fR \fB-a, --audio AUDIO\fR
Shows an alternative, not so user-friendly progress instead of the progress bar which contains more information. Forces to download videos with the given audio locale. If no video with this audio locale is available, nothing will be downloaded. Available locales are: ja-JP, en-US, es-419, es-ES, fr-FR, pt-PT, pt-BR, it-IT, de-DE, ru-RU, ar-SA.
.TP .TP
\fB-a, --audio LOCALE\fR \fB-s, --subtitle SUBTITLE\fR
Forces to download videos with the given audio locale. If no video with this audio locale is available, nothing will be downloaded. Available locales are: ja-JP, en-US, es-LA, es-ES, fr-FR, pt-BR, it-IT, de-DE, ru-RU, ar-ME. Forces to download the videos with subtitles in the given locale / language. If no video with this subtitle locale is available, nothing will be downloaded. Available locales are: ja-JP, en-US, es-419, es-ES, fr-FR, pt-PT, pt-BR, it-IT, de-DE, ru-RU, ar-SA.
.TP .TP
\fB-d, --directory DIRECTORY\fR \fB-d, --directory DIRECTORY\fR
The directory to download all files to. The directory to download all files to.
.TP .TP
\fB--no-hardsub\fR
Same as '-s', but the subtitles are not stored in the video itself, but in a separate file.
.TP
\fB--only-sub\fR
Downloads only the subtitles without the corresponding video.
.TP
\fB-o, --output OUTPUT\fR \fB-o, --output OUTPUT\fR
Name of the output file. Formatting is also supported, so if the name contains one or more of the following things, they will get replaced. Name of the output file. Formatting is also supported, so if the name contains one or more of the following things, they will get replaced.
{title} » Title of the video. {title} » Title of the video.
{series_name} » Name of the series. {series_name} » Name of the series.
{season_title} » Title of the season. {season_name} » Name of the season.
{season_number} » Number of the season. {season_number} » Number of the season.
{episode_number} » Number of the episode. {episode_number} » Number of the episode.
{resolution} » Resolution of the video. {resolution} » Resolution of the video.
@ -94,12 +90,66 @@ The video resolution. Can either be specified via the pixels (e.g. 1920x1080), t
Available common-use words: best (best available resolution), worst (worst available resolution). Available common-use words: best (best available resolution), worst (worst available resolution).
.TP .TP
\fB-s, --subtitle LOCALE\fR \fB-g, --goroutines GOROUTINES\fR
Forces to download the videos with subtitles in the given locale / language. If no video with this subtitle locale is available, nothing will be downloaded. Available locales are: ja-JP, en-US, es-LA, es-ES, fr-FR, pt-BR, it-IT, de-DE, ru-RU, ar-ME. Sets the number of parallel downloads for the segments the final video is made of. Default is the number of cores the computer has.
.SH ARCHIVE COMMAND
This command behaves like \fBdownload\fR besides the fact that it requires \fIffmpeg\fR and stores the output only to .mkv files.
.TP
\fB-l, --language LANGUAGE\fR
Audio locales which should be downloaded. Can be used multiple times. Available locales are: ja-JP, en-US, es-419, es-ES, fr-FR, pt-PT, pt-BR, it-IT, de-DE, ru-RU, ar-SA.
.TP
\fB-d, --directory DIRECTORY\fR
The directory to download all files to.
.TP
\fB-o, --output OUTPUT\fR
Name of the output file. Formatting is also supported, so if the name contains one or more of the following things, they will get replaced.
{title} » Title of the video.
{series_name} » Name of the series.
{season_name} » Name of the season.
{season_number} » Number of the season.
{episode_number} » Number of the episode.
{resolution} » Resolution of the video.
{fps} » Frame Rate of the video.
{audio} » Audio locale of the video.
{subtitle} » Subtitle locale of the video.
.TP
\fB-m, --merge MERGE BEHAVIOR\fR
Sets the behavior of the stream merging. Valid behaviors are 'auto', 'audio', 'video'. \fB--audio\fR stores one video and only the audio of all other languages, \fBvideo\fR stores all videos of the given languages and their audio, \fBauto\fR (which is the default) only behaves like video if the length of two videos are different (and only for the two videos), else like audio.
.TP
\fB-c, --compress COMPRESS\fR
If is set, all output will be compresses into an archive (every url generates a new one). This flag sets the name of the compressed output file. The file ending specifies the compression algorithm. The following algorithms are supported: gzip, tar, zip.
Just like \fB--output\fR the name can be formatted. But the only option available here is \fI{series_name}\fR.
.TP
\fB-r, resolution RESOLUTION\fR
The video resolution. Can either be specified via the pixels (e.g. 1920x1080), the abbreviation for pixels (e.g. 1080p) or "common-use" words (e.g. best).
Available pixels: 1920x1080, 1280x720, 640x480, 480x360, 426x240.
Available abbreviations: 1080p, 720p, 480p, 360p, 240p.
Available common-use words: best (best available resolution), worst (worst available resolution).
.TP .TP
\fB-g, --goroutines GOROUTINES\fR \fB-g, --goroutines GOROUTINES\fR
Sets the number of parallel downloads for the segments the final video is made of. Sets the number of parallel downloads for the segments the final video is made of. Default is the number of cores the computer has.
.SH URL OPTIONS
If you want to download only specific episode of a series, you could either pass every single episode url to the downloader (which is fine for 1 - 3 episodes) or use filtering.
It works pretty simple, just put a specific pattern surrounded by square brackets at the end of the url from the anime you want to download. A season and / or episode as well as a range from where to where episodes should be downloaded can be specified.
Use the list below to get a better overview what is possible
...[E5] - Download the fifth episode.
...[S1] - Download the full first season.
...[-S2] - Download all seasons up to and including season 2.
...[S3E4-] - Download all episodes from and including season 3, episode 4.
...[S1E4-S3] - Download all episodes from and including season 1, episode 4, until and including season 3.
In practise, it would look like this: \fIhttps://beta.crunchyroll.com/series/12345678/example[S1E5-S3E2]\fR.
The \fBS\fR, followed by the number indicates the season number, \fBE\fR, followed by the number indicates an episode number. It doesn't matter if \fBS\fR, \fBE\fR or both are missing. Theoretically \fB[-]\fR is a valid pattern too. Note that \fBS\fR must always stay before \fBE\fR when used.
.SH EXAMPLES .SH EXAMPLES
Login via crunchyroll account email and password. Login via crunchyroll account email and password.
@ -116,7 +166,15 @@ $ crunchyroll-go download -o "darling.mp4" -r 720p https://www.crunchyroll.com/d
Download a episode with japanese audio and american subtitles. Download a episode with japanese audio and american subtitles.
.br .br
$ crunchyroll-go download -a ja-JP -s en-US https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575 $ crunchyroll-go download -a ja-JP -s en-US https://www.crunchyroll.com/darling-in-the-franxx[E3-E5]
Stores the episode in a .mkv file.
.br
$ crunchyroll-go archive https://www.crunchyroll.com/darling-in-the-franxx/darling-in-the-franxx/episode-1-alone-and-lonesome-759575
Downloads the first two episode of Darling in the FranXX and stores it compressed in a file.
.br
$ crunchyroll-go archive -c "ditf.tar.gz" https://www.crunchyroll.com/darling-in-the-franxx/darling-in-the-franxx[E1-E2]
.SH BUGS .SH BUGS
If you notice any bug or want an enhancement, feel free to create a new issue or pull request in the GitHub repository. If you notice any bug or want an enhancement, feel free to create a new issue or pull request in the GitHub repository.
@ -127,7 +185,7 @@ ByteDream
Source: https://github.com/ByteDream/crunchyroll-go Source: https://github.com/ByteDream/crunchyroll-go
.SH COPYRIGHT .SH COPYRIGHT
Copyright (C) 2021 ByteDream Copyright (C) 2022 ByteDream
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public