Coder Social home page Coder Social logo

beardoverflow / mergecrunch Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 4.0 70 KB

A small bash script that combines youtube-dl and mkvmerge for downloading from Crunchyroll in a pretty mkv file

Home Page: http://www.crunchyroll.com/

License: GNU General Public License v2.0

Shell 96.70% Dockerfile 3.30%
youtube-dl crunchyroll anime mkvmerge subtitles rhash mkv fontconfig

mergecrunch's Introduction


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.

Docker image

==This is the recommended way to use this application==

Find this project on DockerHub. Its latest release is working fully at March 20th, 2019

Zero-configuration, for any operating system (Windows, MacOS and Linux). Just pull and run

More information at https://hub.docker.com/r/beardoverflow/mergecrunch

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

Usage

In this section, I will illustrate how to use the application with examples:

Basic example (argument -i):

Input URL using argument -i. Episode will be downloaded with max resolution in the current directory.

./mergecrunch.sh -i URL_CRUNCH_HERE

Playlist selection (append # character in input URL):

For playlist selection, you must append the # character in input URL. After, use selection syntax:

  • "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.

./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#12-20

Example #2. Select ID item 5.

./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#5

Example #3. Select IDs items from 12 to 20 and also 2, 5, 23 to 30.

./mergecrunch.sh -i URL_PLAYLIST_CRUNCH_HERE#12-20,2,5,23-30

Output file name (argument -o):

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

./mergecrunch.sh -i URL_CRUNCH_HERE -o 'Sket Dance 01.mkv'

CRC32 example (argument -x):

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

./mergecrunch.sh -i URL_CRUNCH_HERE -x

Format example (argument -f):

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

./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p
Format Description
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, 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. In this example, set spanish subtitle track as preferred. If you append the --one argument, then esES subtitle track will merged exclusively.

./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p --one -s esES
Language Description
enUS Forces American English
esES Forces European Spanish
esLA Forces American Spanish
frFR Forces Français
itIT Forces Italiano
ptBR Forces Brazilian Português
ptPT Forces European Português
deDE Forces Deutsch
arME Forces العربية
ruRU Forces Русский
jaJP Forces 日本語

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.

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

Account access (argument --cookies and --ua):

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 or cookies.txt from Firefox Add-Ons.

./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esES -o 'Sket Dance 01.mkv' -c cookies.txt

In order to get your user agent, ask to google for getting it using the same browser where you downloaded the cookie file

./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'

For manual install without docker: Dependencies

==Manual install is not recommended way. Only for Debian an derivates. Just for testing purposes==

Install youtube-dl, python3, fontconfig, mkvmerge and rhash

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

sudo apt-get install youtube-dl python3 fontconfig mkvtoolnix rhash

Note 1. Latest version of youtube-dl on all-in-on binary

Note 2. Latest version of mkvmerge on custom Bunkus' repository

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.

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

However, you may specific your password by command line.

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

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.

./mergecrunch.sh -i URL_CRUNCH_HERE -x -f 720p -s esLA -g ruRU

FEEDBACK, BUGS OR CONTRIBUTION

Open an issue in this repository or fork this

LICENSE

GNU General Public License v2.0

mergecrunch's People

Contributors

beardoverflow avatar zenjabba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mergecrunch's Issues

Error: Invalid language specified in '--language 0:'.

http://www.crunchyroll.com/monster-strike/episode-2-slingshot-away-call-me-oragon-725503
STEP 1. GET CRUNCHYROLL STREAMING DOWNLOAD.
[crunchyroll] 725503: Downloading webpage
[crunchyroll] 725503: Downloading deDE m3u8 information
[crunchyroll] 725503: Downloading esES m3u8 information
[crunchyroll] 725503: Downloading jaJP m3u8 information
[crunchyroll] 725503: Downloading frFR m3u8 information
[crunchyroll] 725503: Downloading ptBR m3u8 information
[crunchyroll] 725503: Downloading esLA m3u8 information
[crunchyroll] 725503: Downloading ptPT m3u8 information
[crunchyroll] 725503: Downloading enUS m3u8 information
[crunchyroll] 725503: Downloading media info
[info] Writing video subtitles to: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.frFR.ass
[info] Writing video subtitles to: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.deDE.ass
[info] Writing video subtitles to: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.esLA.ass
[info] Writing video subtitles to: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.enUS.ass
[info] Writing video subtitles to: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.esES.ass
[info] Writing video subtitles to: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.ptBR.ass
[info] Writing video subtitles to: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.ptPT.ass
[download] Destination: Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.mp4
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, hls,applehttp, from 'https://v.vrv.co/evs/cdb4e9b268c98bea9479fda561d61d7e/assets/8e0ee396fb8c58071e791d24e4057a79_3015521.mp4/index-v1-a1.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly92LnZydi5jby9ldnMvY2RiNGU5YjI2OGM5OGJlYTk0NzlmZGE1NjFkNjFkN2UvYXNzZXRzLzhlMGVlMzk2ZmI4YzU4MDcxZTc5MWQyNGU0MDU3YTc5XyoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE1Mzg0MjgwOTF9fX1dfQ__&Signature=ABGgZ49~nvpsadGAwulH7S4~jY0nT2XerIMdXIz4WrdTKkzx7xj3-ERfxVoX4oeNskiHiRycee7SnhhtgNczpmzTp8EiAUCGvolAwFtSMSm1zMFbRpCMQP6XI4I1~U-UBuqd0a~CM6x0HJf-4tZfqcpVRRofeamFguxia9InJ0zrKBJwnXuequjtp3-jlE~g1WlY2GSHI7LkSiTLFn6dPJoaQ8RBny9AK4zBXlBuq3Chfonujn55hwo8PGq2tmHBJwxWoh-nsJI~elPu0A4vo4w4w5LQaDFuZlc8CHMwnPKVR97gMMK~bitKpBfoefnFqTnw-Y13F0oLad5Omgbutw__&Key-Pair-Id=APKAJMWSQ5S7ZB3MF5VA':
Duration: 00:08:37.52, start: 0.101000, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 138 kb/s
Stream #0:2: Data: timed_id3 (ID3 / 0x20334449)
[mp4 @ 0x20e2a80] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x20e2a80] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, mp4, to 'file:Monster Strike Anime 2016 Episode 2 – Slingshot Away! Call Me Oragon!-725503.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 138 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=12408 fps=584 q=-1.0 Lsize= 351722kB time=00:08:37.57 bitrate=5567.0kbits/s
video:343171kB audio:8087kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.131949%
[ffmpeg] Downloaded 360162975 bytes
[download] 100% of 343.48MiB in 00:22
STEP 2. CHECKING AVAILABLE SUBTITLES.
Found Deutsch (Deutschland) subtitle!... Ready.
Found English (USA) subtitle!... Ready.
Found Español (España) subtitle!... Ready.
Found Español (México) subtitle!... Ready.
Found Français (France) subtitle!... Ready.
Found Português (Brasil) subtitle!... Ready.
Found subtitle!... Ready.
STEP 3. CHECKING AVAILABLES ATTACHMENT FONTS TEXT.
Found Arial font!... Ready.
Found Trebuchet MS font!... Ready.
STEP 4. TIME FOR MERGING ALL TO MKV FILE.
Error: Invalid language specified in '--language 0:'.
Merge failed! Exitting...

Enter user agent in script code!

How can I enter the command --user-agent in your script? There was a change in crunchyroll, and you can only resolve by entering that command.

Issue with this file unable to process. I've checked the permissions, but it seems to be something funcky with the script.

./mergecrunch.sh -i http://www.crunchyroll.com/hi-scool-seha-girls#11

Output #0, mp4, to 'file:Hi-sCool! Seha Girls Episode 11 – Dream Rappy, Saturn Rappy, Mega Rappy, Rappy-661667.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 192 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=20381 fps=633 q=-1.0 Lsize= 643496kB time=00:11:20.08 bitrate=7751.2kbits/s
video:632112kB audio:10626kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.117858%
[ffmpeg] Downloaded 658940296 bytes
[download] 100% of 628.41MiB in 00:32
STEP 2. CHECKING AVAILABLE SUBTITLES.
Found English (USA) subtitle!... Ready.
Found Español (México) subtitle!... Ready.
Found Português (Brasil) subtitle!... Ready.
STEP 3. CHECKING AVAILABLES ATTACHMENT FONTS TEXT.
Found Arial font!... Ready.
Found Comic Sans MS font!... Ready.
Found Times New Roman font!... Ready.
Found Trebuchet MS font!... Ready.
STEP 4. TIME FOR MERGING ALL TO MKV FILE.
Error: The file 'Hi-sCool! Seha Girls Episode 11 – Dream Rappy, Saturn Rappy, Mega Rappy, Rappy-661667.mp4' could not be opened for reading: open file error.

Merge only with 1 subtittle

it is possible to merge only with 1 sub? I would like the final file to be only with the chosen language in the -s argument

Nice script btw, help me a lot.

./mergecrunch.sh -i https://www.crunchyroll.com/pt-br/kaguya-sama-love-is-war/episode-10-kaguya-wont-forgive-kaguya-wants-to-forgive-miyuki-shirogane-wants-to-go-somewhere-782600 -f best -s ptBR -o 'KAGUYA-SAMA: LOVE IS WAR Episódio 10' -c cookies.txt --ua 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36' -g ptBR

Selector for session and multiple dubs

I'm experiencing a problem when, for example, the playlist is multi-language, it's a bit complicated to download using #, I was wondering if I could not explore the command --extract-audio to generate a file multi-language, if you have to choose which language will be included in the final file would be even better.

Exemple:
https://i.imgur.com/7JNPuZs.png

Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.