Skip to content

Commit

Permalink
- Completed README with manual
Browse files Browse the repository at this point in the history
- Fixed a few bugs
- v0.0.2-alpha
  • Loading branch information
Oshan96 committed Mar 13, 2020
1 parent 50006e8 commit e1f8e8d
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Anime_Downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def main() :
parser.add_argument("-e", "--end", required=False, help="End episode", default=9999, type=int ,dest="end")
parser.add_argument("-c", "--code", required=False, help="Recaptcha answer token code. Insert this if you don't have 2captcha captcha bypass api_key", default=None, dest="token")
parser.add_argument("-t", "--threads", required=False, help="Number of parrallel downloads. Will download sequencially if not provided", default=1, type=int ,dest="threads")
parser.add_argument("-f", "--filler", required=False, help="Whether fillers needed", default=False, type=bool ,dest="isFiller")
parser.add_argument("-f", "--filler", required=False, help="Whether fillers needed", default=True, type=bool ,dest="isFiller")

args = parser.parse_args()

Expand Down
16 changes: 9 additions & 7 deletions Anime_Scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,18 @@ def extract_page_urls(start_episode, end_episode, token) :
if token is None :
if api_key is None :
Color.printer("ERROR", "No API Key Provided!")
exit(0)
sys.exit(0)

Color.printer("INFO", "Solving recaptcha...")
if api_key != "" or api_key != "insert_2captcha_api_key":
Color.printer("INFO", "Solving recaptcha...")

token = get_token("https://9anime.to/waf-verify")
if not token :
Color.printer("ERROR", "Captcha solving failed! Exiting...")
exit(0)
token = get_token("https://9anime.to/waf-verify")
if not token :
Color.printer("ERROR", "Captcha solving failed! Exiting...")
sys.exit(0)

verify(token)
if token:
verify(token)

Color.printer("INFO", "Extracting page URLs...")

Expand Down
169 changes: 147 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,142 @@
There are two scripts (Anime_Downloader.py, Anime_Scraper.py) to download given anime to a directory and to extract direct download links.
Anime_Scraper.py scraper is used to collect and extract direct anime download links from 9anime.to (From its Mp4Upload server)

## Getting started
## Download Anime Downloader [Windows]
> Note : Currently only windows executable is provided (Linux, Mac users go to "Build from source")
Download the [Latest Relase](https://github.com/Oshan96/Anime-Downloader/releases) from here and extract the zip file

## Downloading

First of all, Anime Downloader uses [2captcha](https://www.2captcha.com) to bypass google recaptcha, so you need to purchase one

Open settings.json and set [2captcha](https://2captcha.com/) API key in "api_key"

```json
"api_key":"insert_2captcha_api_key"
```

*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?)*

Navigate to the extracted folder and open a cmd or powershell window from that folder and execute "anime-dl.exe" from command line.

## How to download using anime-dl?

First of all, you need to be familiar with the commands you can use with the Anime Downloader.

Commands List :
-h, --help show this help message and exit
-u, --url 9Anime.to URL for the anime to be downloaded
-n, --names https://www.animefillerlist.com/ URL to retrieve episode titles
-d, --directory Download destination. Will use the current directory if not provided
-s, --start Starting episode
-e, --end End episode
-c, --code Recaptcha answer token code. Insert this if you don't have 2captcha captcha bypass api_key
-t, --threads Number of parrallel downloads. Will download sequencially if not provided
-f, --filler Whether fillers needed (True/False)

Above mentioned are the arguments you should use in order to download anime.

The below [FAQ](#FAQ) section provides examples on how to download anime

## FAQ

### Q - How can I download one piece anime episodes from 10 to 20?

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

Explantion of the commands used :
1) -u https://9anime.to/watch/one-piece.ov8/169lyx : After the "-u" the 9anime.to url for one piece anime is provided
2) -s 10 : start downloading from 10th episode (included)
3) -e 20 : end downloading at 20th episode (included)
4) -n https://www.animefillerlist.com/shows/one-piece : Provide the animefillerlist.com url for one piece episodes list (this is required)

### Q - How can I download one piece anime episodes 30 to 70 into "D:\Anime\One Piece" folder?

```bash
./anime-dl.exe -u https://9anime.to/watch/one-piece.ov8/169lyx -s 10 -e 20 -n https://www.animefillerlist.com/shows/one-piece -d "D:\Anime\One Piece"
```

Explanation of commands :
1) -d "D:\Anime\One Piece" : Download the episodes into "D:\Anime\One Piece" folder

### Q - How can I download bleach episodes 100 to 130 into "D:\Anime\Bleach" folder and download 4 episodes at once?

```bash
./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
```

Explanation of commands :
1) -t 4 : Perform 4 downloads at once

### Q - How can I download bleach episodes 100 to 130 without filler episodes into "D:\Anime\Bleach" folder and download 3 episodes at once?

```bash
./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
```

Explanation of commands :
1) -f False : Avoid downloading filler episodes in the given range (Default : True)

### Q - I don't have a 2captcha API key, is there any workaround for that?
Answer : Yes ofcourse! If you don't have a 2captcha API key to bypass captcha, you can still download your favourite anime!
*But how?*
Follow these steps and you will be up and running in no time!

Let's try it!

> Assumptions : let's assume you want to download bleach episodes as in the previous question
Steps :
1) Open a private window in the browser (ex: Google chrome)
2) Go to the 9anime url (Bleach page) (https://9anime.to/watch/bleach.6j9/lz7wvq)
3) Now the recaptcha will appear

![recaptcha image](docs/images/recaptcha.png)

4) Right click and open inspection mode (ctrl+shift+i for google chrome)

![inspect window](docs/images/inspect.png)
![inspect window2](docs/images/inspect2.png)

5) Solve the recaptcha appeared on page (DO NOT SUBMIT!)

![solve captcha](docs/images/solve.png)

6) Find the captcha answer from the webpage using inspector

![captcha answer](docs/images/answer.png)

Answer is the "value" of the "input" element with the id "recaptcha-token" (Find for element using this id using ctrl+f to find)
Copy the "value" of the input tag

So the value/recpacha answer is :

<i>"03AERD8Xode9TV-gFkG-7CNkllpKoiXfDKVEZ0Lu9NjGpxVv89bjwNHkS5bcfXHqKXx746tsNW_IUMhSVV7Aym-lcvdn6jd5Ggy1a28AQ_BI1K380joLpYReKB0EOjJjO2oVEUpOgtPu0fgfjxABKpI9EjrDZ0T7iSsKDPfhnXebQcZxIbAwelADkZ8m4qYojn3J_-kQyreIRCEztWyTTpm_SoNt6lIpFxG-egDFqVF6Sg7ICPp0QQrPa5UC-6pecgs_3xspg7PN48VOXGfHH4PCARIaGVL-J5CYNsesqUuZ4t_4kni9euduhtB3KCrV1_IYOhymepwczWIKKPGmze2DKVddoDBABlS8NZaxHRFAzNjjJHOhlRyblBMlmerK_Mu5N25bZeY5ZZ"</i>

Now we have what we need!

All you have to do is, add -c or --code command to the previous example's code like below

```bash
./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
```

### Recaptcha does not appear even in private browsing. What can I do?

Answer :
> Assumptions : let's assume you want to download bleach episodes as in the previous question
This can be solved in 2 steps.

1) Run the anime-dl commands without -c/--code command (like you have a 2captcha key)
This will probably give error, but that's what we need.

2) Now try loading the recaptcha page in private browsing. It will appear!

## Building from source

- Clone the project using to your local machine

Expand All @@ -16,7 +151,7 @@ Anime_Scraper.py scraper is used to collect and extract direct anime download li
1) Download the dependancies using requirements.txt file

```
pip3 install -r requirements.txt
pip install -r requirements.txt
```
2) Rename settings_example.json as settings.json

Expand All @@ -26,7 +161,7 @@ Anime_Scraper.py scraper is used to collect and extract direct anime download li
"api_key":"insert_2captcha_api_key"
```

> If you don't have a 2captcha API key purchased, you can manually set the needed information by feeding a specific webpage to the application and this functionality will be added sooner.
> If you don't have a 2captcha API key purchased, 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?)
## Usage

Expand All @@ -35,7 +170,7 @@ Anime Downloader is a CLI application which takes command line arguments in exec
To see the full available commands, run

```bash
python3 ./Anime_Downloader.py --help
python ./Anime_Downloader.py --help
```

```
Expand All @@ -46,24 +181,14 @@ Anime Downloader Command Line Tool
optional arguments:
-h, --help show this help message and exit
-u <URL>, --url <URL> 9Anime.to URL for the anime to be downloaded
-n <TITLE_URL>, --names <TITLE_URL>
https://www.animefillerlist.com/ URL to retrieve
episode titles
-d <DIR>, --directory <DIR>
Download destination. Will use the current directory
if not provided
-s <START>, --start <START>
Starting episode
-e <END>, --end <END> End episode
-c <TS_NO>, --code <TS_NO>
data-ts tag value of the given url webpage. Insert
this if you don't have 2captcha captcha bypass api_key
-t <THREADS>, --threads <THREADS>
Number of parrallel downloads. Will download
sequencially if not provided
-f <ISFILLER>, --filler <ISFILLER>
Whether fillers needed (True/False)
-u, --url 9Anime.to URL for the anime to be downloaded
-n, --names https://www.animefillerlist.com/ URL to retrieve episode titles
-d, --directory Download destination. Will use the current directory if not provided
-s, --start Starting episode
-e, --end End episode
-c, --code Recaptcha answer token code. Insert this if you don't have 2captcha captcha bypass api_key
-t, --threads Number of parrallel downloads. Will download sequencially if not provided
-f, --filler Whether fillers needed (True/False)
```
## Examples
Expand Down
Binary file added docs/images/answer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/inspect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/inspect2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/recaptcha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/solve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e1f8e8d

Please sign in to comment.