Skip to content

Commit

Permalink
[Refactor] Working on README.md and DOCKER.md
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardOverflow committed Mar 20, 2019
1 parent 0ab5596 commit 86f8d8a
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 76 deletions.
72 changes: 72 additions & 0 deletions DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# MergeCrunch

## What is MergeCrunch?

An application for easily download video content from Crunchyroll combining youtube-dl and mkvmerge. Build a fancy-mkv file with subtitles and fonts attached

## Features

- Choose between softsub or hardsub (no transcoding!)
- Choose as you want to download: individual episode, several episodies or full series
- Choose which quality you want to get (from 240p to 1080p)
- On softsubbing, attach only one subtitle track or all subtitles track
- On softsubbing, attach your own fonts to the mkv file
- On softsubbing, warn if there are fonts missing
- Spoof your user-agent and cookies file for logging with your account

## How to use this image?

Before starting, you must get your cookies file (to export your Crunchyroll authentication) and know which is your user agent (even if you haven't an account, just for bypassing Cloudflare).

To next, you must prepare a volume where you will place your future downloads. In this folder, you must put your cookies file too. The container path for the downloads will be /downloads

Additionally, you could prepare a volume where you will place custom fonts. (A warning appears while downloading a video when a font is missing). The container path for the fonts will be /fonts

### Examples

# For first time or receiving updates
sudo docker pull beardoverflow/mergecrunch

# Example
sudo docker run--rm -it \
-v /home/beardoverflow/downloads:/downloads \
-v /home/beardoverflow/.fonts:/fonts \
beardoverflow/mergecrunch \
-i https://www.crunch... \
--ua 'PUT HERE YOUR USER AGENT' \
-c /downloads/cookies.txt \
-f 720p -s esES

### Configuration

-i Input single video URL or playlist URL
-c Container path to the cookies file
-x Renames the file appending its CRC32 hash at the end of filename
-f Video quality. Accepted values: worst, 240p, 360p, 480p, 720p, 1080p, best
-s Set the default subtitle track. Required on: --one, --hard. Accepted values: enUS, esES,esLA, frFR, itIT, ptBR, ptPT, deDE, arME, ruRU, jaJP
--one On softsubing, it merges only the default subtitle track. If it absents, then all available subtitles track will be merged
--hard Forces hardsubing, any subtitle track will be omitted

## How to get your cookies file? (For using your premium account)

Install cookies.txt extension in your browser

[Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/)

[Chrome](https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg)

Enter to the Crunchyroll's website and press the extension's cookie button. Place the file in the same folder where you will put your downloads

## How to know your user agent? (For bypassing CloudFlare)

Ask to google from the same browser

https://www.google.com/search?q=what+is+my+user+agent

## Advance configuration / More information

At https://github.com/BeardOverflow/MergeCrunch

![](https://raw.githubusercontent.com/BeardOverflow/MergeCrunch/master/logo.png)

*Update at Mar 20, 2019*
161 changes: 85 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,106 @@
![](/logo.png)

***
## What is MergeCrunch?

## Description
An application for easily download video content from Crunchyroll combining youtube-dl and mkvmerge. Build a fancy-mkv file with subtitles and fonts attached.

MergeCrunch is a small bash script (/ironic off) that combines youtube-dl and mkvmerge for getting anime.
## Docker image

The main feature is to generate a pretty mkv file with all availables soft-subtitles from **Crunchyroll** site and after required fonts are attached from fontconfig.
==This is the recommended way to use this application==

Now support to premium users!!
Find this project on DockerHub. Its latest release is working fully at March 20th, 2019

Now support to playlist URLs and playlist selection!!
**Zero-configuration, for any operating system (Windows, MacOS and Linux). Just pull and run**

Now support to cookies file!!
More information at https://hub.docker.com/r/beardoverflow/mergecrunch

Now support to spoof your location!!
## Features

Now support to spoof your user-agent!!
- Choose between softsub or hardsub (no transcoding!)
- Choose as you want to download: individual episode, several episodies or full series
- Choose which quality you want to get (from 240p to 1080p)
- On softsubbing, attach only one subtitle track or all subtitles track
- On softsubbing, attach your own fonts to the mkv file
- On softsubbing, warn if there are fonts missing
- Spoof your user-agent and cookies file for logging with your account

Now support for hardsub or softsub both!!
## Usage

==Tested in Ubuntu 16.04 Xenial, 18.04 Bionic and Debian 9 Stretch, 10 Buster==
In this section, I will illustrate how to use the application with examples:

## Dependencies
**Basic example (argument -i):**

You must have installed youtube-dl, fontconfig and mkvmerge, as minimum.
Input URL using argument -i. Episode will be downloaded with max resolution in the current directory.

Rhash is recommended for calculating CRC32 hash sum.
```sh
./mergecrunch.sh -i URL_CRUNCH_HERE
```

For getting this dependencies, execute the classic sudo apt-get install.
**Playlist selection (append # character in input URL):**

Note 1. For youtube-dl, I would recommend to use [nilarimogard's ppa](https://launchpad.net/~nilarimogard/+archive/ubuntu/webupd8).
For playlist selection, you must append the # character in input URL. After, use selection syntax:

Note 2. For mkvtoolnix, I would recommend to use [custom Bunkus' repository](https://www.bunkus.org/videotools/mkvtoolnix/downloads.html#ubuntu).
- "N-M" for selecting inclusive range from N to M.
- "N" for simple selection.
- "," as separator for multiple selections.

Example #1. Select IDs items from 12 to 20.
```sh
sudo apt-get install youtube-dl
sudo apt-get install fontconfig
sudo apt-get install mkvtoolnix
sudo apt-get install rhash
./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#12-20
```

For solving fonts text dependencies, create a folder in your home dir called ~/.fonts and put here any font text missing.
When you run this script, mkvmerge needs fonts text installed previous in your system for adding it as attachment.
Example #2. Select ID item 5.
```sh
./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#5
```

## Usage
Example #3. Select IDs items from 12 to 20 and also 2, 5, 23 to 30.
```sh
./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#12-20,2,5,23-30
```

For this section, I will ilustrate how to use it with examples:
**Output file name (argument -o):**

In this example, output file will renamed as "Sket Dance 01 [CRC32_HERE].mkv"

**Basic example (argument -i):**
```sh
./mergecrunch.sh -i URL_CRUNCH_HERE
./mergecrunch.sh -i URL_CRUNCH_HERE -o 'Sket Dance 01.mkv'
```
Episode will be downloaded with max resolution in the current directory

**CRC32 example (argument -x):**

In this example, CRC32 will be calculated and stored in the filename.

```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x
```
Same top, but now CRC32 will be calculated and stored in the filename.

**Format example (argument -f):**

In this example, resolution will be 1280x720. Be careful with this argument, some resolution are availabled for premium users only.

```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p
```
Same top, but now resolution will be 1280x720. Be careful with this argument, some resolution are availabled for premium users only.

Format | Description
------ | -----------
worst | The worst resolution available (generally 360p or 480p)
worst | The worst resolution available (generally 240p, 360p or 480p)
240p | 320x240 or 420x240
360p | 480x360 or 640x360
480p | 640x360 or 848x480
720p | 1280x720
1080p | 1920x1080
best | The best resolution available (generally 480p or 1080p)
best | The best resolution available (generally 480p, 720p or 1080p)

**Preferred language (argument -s) + Only one language (argument --one):**

Using a preferred language, you set a default subtitle track in your mkv. Also, title description and default output filename are set according to this language.
Using a preferred language, you set a default subtitle track in your mkv. In this example, set spanish subtitle track as preferred. If you append the --one argument, then esES subtitle track will merged exclusively.

```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p --one -s esES
```
Same top, but now I set spanish subtitle track as preferred. If you append the --one argument, then esES subtitle track will merged exclusively.

Language | Description
-------- | -----------
Expand All @@ -98,82 +116,73 @@ arME | Forces العربية
ruRU | Forces Русский
jaJP | Forces 日本語

**Hardsub switch (argument --hard):**
**Hardsubbing switch (argument --hard):**

If you wish download a hardsub video instead of merging a soft subtitle track, you can append the --hard argument. Require -s argument and implies --one argument.

```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p --hard -s esES
```

**Spoof location (argument -g):**

Similar to choose your preferred language, you can spoof your location in order to download videos from foreign locations. The following example shows a spoof location to Russia and preferred language to American Spanish.
**Account access (argument --cookies and --ua):**

Also, default output filename will be in russian.
You must get your cookies file (to export your Crunchyroll authentication) and know which is your user agent (bypassing Cloudflare).

In order to get your cookie file (argument --cookies or -c), I would recommend to use an extension navigator such as [cookies.txt from Chrome Store](https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg) or [cookies.txt from Firefox Add-Ons](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/).
```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esLA -g ruRU
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -c cookies.txt
```

**Output file name (argument -o):**
```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv'
In order to get your user agent, [ask to google for getting it using the same browser where you downloaded the cookie file](https://www.google.com/search?q=what+is+my+user+agent)
```
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -c cookies.txt --ua 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'
```
Same top, but now output file will renamed as "Sket Dance 01 [CRC32_HERE].mkv"

## For manual install without docker: Dependencies

**Premium account (argument -u and -p OR argument -c):**
```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -u BeardOverflow
```
Same top, but I am logging in my premium account. The console will prompt for username's password.
==Manual install is not recommended way. Only for Debian an derivates. Just for testing purposes==

However, you may specific your password by command line.
```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -u BeardOverflow -p mysecretpassword
```
Install youtube-dl, python3, fontconfig, mkvmerge and rhash

For getting this dependencies, execute the classic sudo apt-get install.

Sometimes, the login access could fail using argument -u (because youtube-dl is outdated). In this case, you could use a cookie file. In order to get your cookie file, I would recommend to use an extension navigator such as [cookies.txt from Chrome Store](https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg) or [cookies.txt from Firefox Add-Ons](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/).
```sh
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -c cookies.txt
sudo apt-get install youtube-dl python3 fontconfig mkvtoolnix rhash
```

With the latest changes in CR, you must set your user-agent (argument --ua) and cookies file together. [Ask to google for getting it using the same browser where you downloaded the cookie file](https://www.google.com/search?q=what+is+my+user+agent)
```
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -c cookies.txt --ua 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'
```
Note 1. Latest version of youtube-dl on [all-in-on binary](https://ytdl-org.github.io/youtube-dl/download.html)

**Playlist selection (append # character in input URL):**
Note 2. Latest version of mkvmerge on [custom Bunkus' repository](https://mkvtoolnix.download/downloads.html#debian)

For playlist selection, you must append the # character in input URL. After, according to selection syntaxis:
- "N-M" for select range from N to M.
- "N" for simple selection.
- "," as separator for multiple selections.
Fontconfig is the engine to search for fonts in your system. If the applicationg warns you about missing fonts, create a folder in your home path called ~/.fonts and put in here the missing fonts

## DEPRECATED OPTIONS

**Premium account (argument -u and -p):**

In this example, I am logging in my premium account. **Deprecated by Crunchyroll’s new verifications.** The console will prompt for username's password.

Example #1. Select IDs items from 12 to 20.
```sh
./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#12-20
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -u BeardOverflow
```

Example #2. Select ID item 5.
However, you may specific your password by command line.

```sh
./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#5
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -u BeardOverflow -p mysecretpassword
```

Example #3. Select IDs items from 12 to 20 and also 2, 5, 23 to 30.
**Spoof location (argument -g):**

Similar to choose your preferred language, you can spoof your location in order to download videos from foreign locations. The following example shows a spoof location to Russia and preferred language to American Spanish. **Deprecated by Crunchyroll's new verifications.**

```sh
./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#12-20,2,5,23-30
./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esLA -g ruRU
```


## FEEDBACK, BUGS OR CONTRIBUTION
- If you need some help, I will be glad to help you.
- Please report all errors, getting them is great.
- If you want to help me with something please create a pull request :)

Open an issue in this repository or fork this

## LICENSE
GNU General Public License v2.0



0 comments on commit 86f8d8a

Please sign in to comment.