Skip to content

Commit 9757f7c

Browse files
authored
Merge pull request #22 from Oshan96/dev
Dev - monkey-dl v1.0.4 PR
2 parents 130c87c + 5901624 commit 9757f7c

File tree

20 files changed

+478
-60
lines changed

20 files changed

+478
-60
lines changed

README.md

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
1-
# Anime Downloader [![Total Downloads](https://img.shields.io/github/downloads/Oshan96/Anime-Downloader/total.svg?style=for-the-badge)](https://github.com/Oshan96/Anime-Downloader/releases)
1+
![Banner](docs/images/banner.png)<br>
2+
# Monkey-DL (Anime Downloader) [![Total Downloads](https://img.shields.io/github/downloads/Oshan96/Anime-Downloader/total.svg?style=for-the-badge)](https://github.com/Oshan96/Anime-Downloader/releases)
23

34
You can now bulk download your favourite anime episodes for various websites, in various resolutions, with or without filler episodes
45

56
[See supported websites](#Supported-Websites)
67

78
## Donations
89
If this project is helpful to you and love my work and feel like showing love/appreciation, would you like to buy me a coffee?<br>
9-
<a href="https://www.buymeacoffee.com/Oshan96" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
10+
<a href="https://buymeacoff.ee/Oshan96" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
11+
12+
## Features
13+
* Download Anime from various [supported websites](#Supported-Websites)
14+
* Batch download episodes in the given range at once
15+
* High speed downloads
16+
* Download multiple episodes at once
17+
* Select the resolution (from the available resolutions for the website)
18+
* Select sub/dub (Check whether the website supports selective sub/dub downloads from [here](#Supported-Websites))
19+
* Choose whether filler episodes need to be downloaded or not by selecting "Download fillers" (By providing animefillerlist URL)
20+
* Name the files in "Episode - {episode_number} - {episode_title}" format by providing animefillerlist URL
21+
* Choose the directory files need to be downloaded into
22+
* Custom HLSDownloader (Now FFMPEG installation is optional from v1.0.4 upwards)
23+
* Custom decryptors for encrypted websites
1024

1125
## Supported Websites
12-
| Website | Need recaptcha token? | Supported resolutions | FFMPEG needed? | File Size | Additional Notes |
13-
|--- |--- |--- |--- |--- |--- |
14-
| [9Anime](https://9anime.to/) | Yes | Default only | No | 500-600MB | Will always work, provided token |
15-
| [4Anime](https://4anime.to/) | No | Default only | No | Around 150MB | Upon failure, visit 4anime website and restart anime downloader. Fastest downloads |
16-
| [AnimePahe](https://animepahe.com/) | No | 720p, 1080p | No | 720p: ~150MB, 1080p: ~200MB | 2captcha API key is needed to download from AnimePahe. Also download speed is capped by host |
17-
| [AnimeFreak](https://www.animefreak.tv/) | No | Default only | No | ~90-100MB | Downloading from AnimeFreak would be a bit slow at times |
18-
| [GoGoAnime](https://gogoanime.io/) | No | Mostly 360p, 480p | Yes | - | gogoanime.io and gogoanime.video are supported. gogoanime.pro support will be added in future |
19-
| [AnimeUltima](https://www.animeultima.to/) | No | 240p, 360p, 480p, 720p, 1080p | Yes | 1080p is around 1GB | AnimeUltima is having issues in their end. Will be supported again once they are backup |
26+
27+
#### Note
28+
After v1.0.4 release, Monkey-DL now uses a custom HLSDownloader to download from streams, which is over 10x faster than downloading from FFMPEG. FFMPEG is now optional to be installed in system. FFMPEG will only be used if there is any error occured. So for now, it is safe FFMPEG to be installed as well.
29+
FFMPEG dependency will be removed completely soon in a later release
30+
31+
| Website |Sub/Dub selection | Need recaptcha token? | Supported resolutions | FFMPEG needed? | File Size | Additional Notes |
32+
|--- |--- |--- |--- |--- |--- |--- |
33+
| [9Anime](https://9anime.to/) | No | Yes | Default only | No | 500-600MB | Will always work, provided token |
34+
| [4Anime](https://4anime.to/) | No | No | Default only | No | Around 150MB | Upon failure, visit 4anime website and restart anime downloader. Fastest downloads |
35+
| [AnimePahe](https://animepahe.com/) | No | No | 720p, 1080p | No | 720p: ~150MB, 1080p: ~200MB | 2captcha API key is needed to download from AnimePahe. Also download speed is capped by host |
36+
| [Twist](https://twist.moe/) | No | No | 1080p | No | 500MB+ | Files are very high quality and fast downloads. Seems to be raw HorribleSub content |
37+
| [AnimeFreak](https://www.animefreak.tv/) | Yes | No | Default only | No | ~90-100MB | Downloading from AnimeFreak is generally fast |
38+
| [GoGoAnime](https://gogoanime.io/) | No | No | Mostly 360p, 480p | Optional | - | gogoanime.io and gogoanime.video are supported. gogoanime.pro support will be added in future |
39+
| [AnimeUltima](https://www.animeultima.to/) | Yes | No | Sub: 240p, 360p, 480p, 720p, 1080p<br><br> Dub: Default only | Optional | 1080p is 1GB+ | File sizes are relatively large |
40+
| [AnimeFlix](https://animeflix.io/) | Yes | No | Sub: 240p, 360p, 480p, 720p, 1080p<br><br> Dub: Default only | Optional | 1080p is 1GB+ | File sizes are relatively large |
2041

2142
## Download Anime Downloader [Windows]
2243
> Note : Currently only windows executable is provided (Linux, Mac users go to [Build from source](#Building-from-source))
@@ -35,7 +56,7 @@ Open settings.json and set [2captcha](https://2captcha.com/) API key in "api_key
3556

3657
*Don't have 2captcha API key? Don't worry! You can still use this to download anime. Check the "FAQ" section on [how to download if you don't have a 2captcha API key](#Q---I-don't-have-a-2captcha-API-key,-is-there-any-workaround-for-that?)*
3758

38-
##### And in order to download from some websites (like animeultima.to) Anime Downloader requires you to have [FFMPEG](https://www.ffmpeg.org/) to be downloaded ([Check whether your anime website needs FFMPEG](#Supported-Websites))
59+
##### In order to download from some websites (like animeultima.to) Anime Downloader requires you to have [FFMPEG](https://www.ffmpeg.org/) to be downloaded ([Check whether your anime website needs FFMPEG](#Supported-Websites))
3960

4061
- You can download FFMPEG from [here](https://www.ffmpeg.org/download.html)
4162
- And then add the ffmpeg executable to system path
@@ -49,12 +70,18 @@ sudo apt install ffmpeg
4970
#### Still not able to download? Go ahead and post your issue [here](https://github.com/Oshan96/Anime-Downloader/issues). And I will look into the error and give necessary fixes!
5071

5172
## Running the application
52-
Navigate to the extracted folder and open a cmd or powershell window from that folder and execute "anime-dl.exe" from command line.
73+
Navigate to the extracted folder and open a cmd or powershell window from that folder and execute "monkey-dl.exe" from command line.
5374

5475
## How to download using GUI version (v0.1.1-alpha upwards)
5576
It is same as the CLI version, but provided a graphical user interface to collect necessary parameters.
5677

57-
Execute the "anime-dl.exe" to start.
78+
Note : After v1.0.4 and anove, Anime Downloader was named as "Monkey-DL" and the executable is called "monkey-dl.exe"
79+
80+
* v1.0.4 and above:
81+
Execute the "monkey-dl.exe" to start.
82+
83+
* v1.0.3 and lower:
84+
Execute the "anime-dl.exe" to start.
5885

5986
If you're running from source files, execute the "anime-dl.py" script
6087

@@ -93,7 +120,7 @@ Above mentioned are the arguments you should use in order to download anime.
93120
### Q - How can I download one piece anime episodes from 10 to 20?
94121

95122
```bash
96-
./anime-dl.exe -u https://9anime.to/watch/one-piece.ov8/169lyx -s 10 -e 20 -n https://www.animefillerlist.com/shows/one-piece
123+
./anime-dl.py -u https://9anime.to/watch/one-piece.ov8/169lyx -s 10 -e 20 -n https://www.animefillerlist.com/shows/one-piece
97124
```
98125

99126
Explantion of the commands used :
@@ -105,7 +132,7 @@ Explantion of the commands used :
105132
### Q - How can I download one piece anime episodes 30 to 70 into "D:\Anime\One Piece" folder?
106133

107134
```bash
108-
./anime-dl.exe -u https://9anime.to/watch/one-piece.ov8/169lyx -s 30 -e 70 -n https://www.animefillerlist.com/shows/one-piece -d "D:\Anime\One Piece"
135+
./anime-dl.py -u https://9anime.to/watch/one-piece.ov8/169lyx -s 30 -e 70 -n https://www.animefillerlist.com/shows/one-piece -d "D:\Anime\One Piece"
109136
```
110137

111138
Explanation of commands :
@@ -114,7 +141,7 @@ Explanation of commands :
114141
### Q - How can I download bleach episodes 100 to 130 into "D:\Anime\Bleach" folder and download 4 episodes at once?
115142

116143
```bash
117-
./anime-dl.exe -u https://9anime.to/watch/bleach.6j9/lz7wvq -s 100 -e 130 -n https://www.animefillerlist.com/shows/bleach -d "D:\Anime\Bleach" -t 4
144+
./anime-dl.py -u https://9anime.to/watch/bleach.6j9/lz7wvq -s 100 -e 130 -n https://www.animefillerlist.com/shows/bleach -d "D:\Anime\Bleach" -t 4
118145
```
119146

120147
Explanation of commands :
@@ -123,7 +150,7 @@ Explanation of commands :
123150
### Q - How can I download bleach episodes 100 to 130 without filler episodes into "D:\Anime\Bleach" folder and download 3 episodes at once?
124151

125152
```bash
126-
./anime-dl.exe -u https://9anime.to/watch/bleach.6j9/lz7wvq -s 100 -e 130 -n https://www.animefillerlist.com/shows/bleach -d "D:\Anime\Bleach" -t 3 -f False
153+
./anime-dl.py -u https://9anime.to/watch/bleach.6j9/lz7wvq -s 100 -e 130 -n https://www.animefillerlist.com/shows/bleach -d "D:\Anime\Bleach" -t 3 -f False
127154
```
128155

129156
Explanation of commands :
@@ -172,7 +199,7 @@ Now we have what we need!
172199
All you have to do is, add -c or --code command to the previous example's code like below
173200

174201
```bash
175-
./anime-dl.exe -u https://9anime.to/watch/bleach.6j9/lz7wvq -s 100 -e 130 -n https://www.animefillerlist.com/shows/bleach -d "D:\Anime\Bleach" -t 4 -f False -c 03AERD8Xode9TV-gFkG-7CNkllpKoiXfDKVEZ0Lu9NjGpxVv89bjwNHkS5bcfXHqKXx746tsNW_IUMhSVV7Aym-lcvdn6jd5Ggy1a28AQ_BI1K380joLpYReKB0EOjJjO2oVEUpOgtPu0fgfjxABKpI9EjrDZ0T7iSsKDPfhnXebQcZxIbAwelADkZ8m4qYojn3J_-kQyreIRCEztWyTTpm_SoNt6lIpFxG-egDFqVF6Sg7ICPp0QQrPa5UC-6pecgs_3xspg7PN48VOXGfHH4PCARIaGVL-J5CYNsesqUuZ4t_4kni9euduhtB3KCrV1_IYOhymepwczWIKKPGmze2DKVddoDBABlS8NZaxHRFAzNjjJHOhlRyblBMlmerK_Mu5N25bZeY5ZZ
202+
./anime-dl.py -u https://9anime.to/watch/bleach.6j9/lz7wvq -s 100 -e 130 -n https://www.animefillerlist.com/shows/bleach -d "D:\Anime\Bleach" -t 4 -f False -c 03AERD8Xode9TV-gFkG-7CNkllpKoiXfDKVEZ0Lu9NjGpxVv89bjwNHkS5bcfXHqKXx746tsNW_IUMhSVV7Aym-lcvdn6jd5Ggy1a28AQ_BI1K380joLpYReKB0EOjJjO2oVEUpOgtPu0fgfjxABKpI9EjrDZ0T7iSsKDPfhnXebQcZxIbAwelADkZ8m4qYojn3J_-kQyreIRCEztWyTTpm_SoNt6lIpFxG-egDFqVF6Sg7ICPp0QQrPa5UC-6pecgs_3xspg7PN48VOXGfHH4PCARIaGVL-J5CYNsesqUuZ4t_4kni9euduhtB3KCrV1_IYOhymepwczWIKKPGmze2DKVddoDBABlS8NZaxHRFAzNjjJHOhlRyblBMlmerK_Mu5N25bZeY5ZZ
176203
```
177204

178205
### Recaptcha does not appear even in private browsing. What can I do?
@@ -282,9 +309,13 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md
282309
Anime Downloader wouldn't be possible without these awesome free and opensource projects!
283310
- [CloudScraper](https://github.com/VeNoMouS/cloudscraper)
284311
- [Js2Py](https://github.com/PiotrDabkowski/Js2Py)
312+
- [JsBeautifier](https://github.com/beautify-web/js-beautify)
313+
- [PyCryptodome](https://github.com/Legrandin/pycryptodome)
285314
- [PySimpleGUI](https://github.com/PySimpleGUI/PySimpleGUI)
286315
- [FFMPEG](https://ffmpeg.org/)
287316

317+
Special thanks to [u/sln0913](https://www.reddit.com/user/sln0913) for the awesome logo and banner designs!
318+
288319
## Disclaimer
289320

290321
This software has been developed only for educational purposes by the [Author](https://github.com/Oshan96). By no means this encourage content piracy. Please support original content creators!

anime_downloader/Anime_Downloader.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
import shutil
66
import os
77
import sys
8+
import traceback
89
from platform import system
910
from threading import Thread
1011
from queue import Queue
1112
from art import text2art
1213
from util import Color
1314
from util.ffmpeg_downloader import FFMPEGDownloader
15+
from util.hls_downloader import HLSDownloader
1416
from scrapers.nineanime import Anime_Scraper
1517

1618
directory = ""
@@ -72,16 +74,16 @@ def __clean_file_name(self, file_name):
7274
return file_name
7375

7476
def __download_episode(self, episode):
77+
if system() == "Windows":
78+
episode.title = self.__clean_file_name(episode.title)
79+
7580
if episode.is_direct:
7681
if episode.download_url is None:
7782
Color.printer("ERROR", "Download URL is not set for " + episode.episode + ", skipping...", self.gui)
7883
return
7984

8085
Color.printer("INFO", "Downloading " + episode.episode + "...", self.gui)
8186

82-
if system() == "Windows":
83-
episode.title = self.__clean_file_name(episode.title)
84-
8587
# print(self.is_titles)
8688
# print(episode.title)
8789

@@ -92,15 +94,21 @@ def __download_episode(self, episode):
9294
# print("without title")
9395
file_name = self.directory + episode.episode + ".mp4"
9496

95-
with requests.get(episode.download_url, stream=True, verify=False) as r:
97+
with requests.get(episode.download_url, headers=episode.request_headers, stream=True, verify=False) as r:
9698
with open(file_name, 'wb') as f:
9799
shutil.copyfileobj(r.raw, f, length=16 * 1024 * 1024)
98100

99101
Color.printer("INFO", episode.episode + " finished downloading...", self.gui)
100102

101103
else:
102-
Color.printer("INFO", "HLS link found. Using FFMPEG to download...", self.gui)
103-
FFMPEGDownloader(episode, self.directory, self.gui).download()
104+
Color.printer("INFO", "HLS link found. Using custom HLSDownloader to download...", self.gui)
105+
try:
106+
HLSDownloader(episode, self.directory, requests.session(), self.gui).download()
107+
except Exception as ex:
108+
trace = traceback.format_exc()
109+
print(trace)
110+
Color.printer("ERROR", "Custom HLS Downloader failed! Using FFMPEG to download...", self.gui)
111+
FFMPEGDownloader(episode, self.directory, self.gui).download()
104112

105113
def download(self):
106114

anime_downloader/app.ico

21.3 KB
Binary file not shown.

anime_downloader/app.png

3.84 KB
Loading

anime_downloader/extractors/base_extractor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ class BaseExtractor:
33

44
def __init__(self, url, session):
55
self.url = url
6-
self.session = session
6+
if session is None:
7+
self.session = cloudscraper.create_scraper()
8+
else:
9+
self.session = session
710

811
def extract_page_content(self):
912
video_page = self.session.get(self.url)

anime_downloader/extractors/jwplayer_extractor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ def extract_direct_url(self):
3333
# if the given resolution is not found, the first available link would be given
3434
def get_resolution_link(self, master_url, resolution):
3535
count = 0
36-
content = self.session.get(master_url).text
36+
try:
37+
content = self.session.get(master_url).text
38+
except:
39+
print("retry")
40+
content = self.session.get(master_url).text
41+
3742
data_list = content.split("\n")
3843

3944
link = None

0 commit comments

Comments
 (0)