Skip to content

Commit

Permalink
Support for whole show downloading
Browse files Browse the repository at this point in the history
Check the
[Changelog](https://github.com/Xonshiz/anime-dl/blob/master/Changelog.md)
for more information and check the updated
[Readme](https://github.com/Xonshiz/anime-dl/blob/master/ReadMe.md) for
a detailed guide.
  • Loading branch information
Xonshiz committed Mar 27, 2017
1 parent 9b8710a commit 8833c99
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
- Site support for Crunchyroll.com [2017.03.05]
- Fix for #1 [2017.03.06]
- Fix for #2 [2017.03.06]
- ReadMe updated for Python Script execution [2017.03.06]
- ReadMe updated for Python Script execution [2017.03.06]
- Support for Whole Show Downloading for Crunchyroll [2017.03.06]
- Selection of language for the Crunchyroll Show [2017.03.06]
10 changes: 9 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Anime-dl is a Command-line program to download anime from CrunchyRoll and Funima
* [Usage](#usage)
* [Windows](#windows)
* [Linux/Debian](#linuxdebian)
* [Example URLs](#example-urls)
* [Features](#features)
* [Changelog](https://github.com/Xonshiz/anime-dl/blob/master/Changelog.md)
* [Opening An Issue/Requesting A Site](#opening-an-issuerequesting-a-site)
Expand Down Expand Up @@ -76,7 +77,8 @@ Currently, the script supports these arguments :
-V,--version Prints the VERSION and exits.
-u,--username Indicates username for a website.
-p,--password Indicates password for a website.
-r,--resolution Indicates the desired resolution (default = 720p)
-r,--resolution Indicates the desired resolution. (default = 720p)
-l,--language Selects the language for the show. (default = Japanese) [Langs = english, dub, sub, Japanese, eng]
```

## Usage
Expand Down Expand Up @@ -110,6 +112,12 @@ After you've saved this script in a directory/folder, you need to open `command

URL can be any URL of the [supported websites](https://github.com/Xonshiz/anime-dl/blob/master/Supported_Sites.md).

### Example URLs
* Crunchyroll :
* Single Episode : [http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059](http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059)
* Whole Show : [http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying](http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying)


## Features
This is a very basic and small sript, so at the moment it only have a few features.
* Downloads a Single episode along with all the available subtitles for that episode.
Expand Down
2 changes: 1 addition & 1 deletion anime_dl/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class main(object):
required_args.add_argument('-u', '--username', nargs=1, help='Indicates username for a website.')
required_args.add_argument('-i', '--input', nargs=1, help='Inputs the URL to anime.')
parser.add_argument('-r', '--resolution', nargs=1, help='Inputs the URL to anime.', default='720p')
parser.add_argument('-l', '--language', nargs=1, help='Inputs the URL to anime.', default='Japanese')
parser.add_argument('-l', '--language', nargs=1, help='Selects the language for the show.', default='Japanese')

args = parser.parse_args()

Expand Down
46 changes: 45 additions & 1 deletion anime_dl/sites/crunchyroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,52 @@ def singleEpisode(self, url, cookies, token, resolution):
height, file_name, cookies, token)

def wholeShow(self, url, cookie, token, language, resolution):
# print("Check my patreon for this : http://patreon.com/Xonshiz")

print("Please check my Patreon : https://patreon.com/Xonshiz")
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7',
'Upgrade-Insecure-Requests': '1',
'Accept-Encoding': 'gzip, deflate'
}

sess = session()
sess = create_scraper(sess)
page_source = sess.get(url=url, headers=headers, cookies=cookie).text

dub_list = []
sub_list = []
for episode_link, episode_type in findall(r'\<a href\=\"\/(.*?)\"\ title\=\"(.*?)\"\ class\=\"portrait\-element\ block\-link', str(page_source)):
if "(Dub)" in str(episode_type):
dub_list.append(str(url) + str(episode_link))
else:
sub_list.append(str(url) + str(episode_link))

if len(dub_list) == 0 and len(sub_list) == 0:
print("Could not find the show links. Report on https://github.com/Xonshiz/anime-dl/issues/new")
exit()

if str(language).lower() in ["english", "eng", "dub"]:
# If the "dub_list" is empty, that means there are no English Dubs for the show, or CR changed something.
if len(dub_list) == 0:
print("No English Dub Available For This Series.")
print("If you can see the Dubs, please open an Issue on https://github.com/Xonshiz/anime-dl/issues/new")
exit()
else:
print("Total Episodes to download : %s" % len(dub_list))
for episode_url in dub_list[::-1]:
# cookies, Token = self.webpagedownloader(url=url)
# print("Dub list : %s" % dub_list)
self.singleEpisode(url=episode_url, cookies=cookie, token=token, resolution=resolution)
print("-----------------------------------------------------------")
print("\n")
else:
print("Total Episodes to download : %s" % len(sub_list))
for episode_url in sub_list[::-1]:
# cookies, Token = self.webpagedownloader(url=url)
# print("Sub list : %s" % sub_list)
self.singleEpisode(url=episode_url, cookies=cookie, token=token, resolution=resolution)
print("-----------------------------------------------------------")
print("\n")

def subFetcher(self, xml, anime_name, episode_number):
headers = {
Expand Down
2 changes: 1 addition & 1 deletion anime_dl/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Format : YY/MM/DD
__version__ = "2017.03.06"
__version__ = "2017.03.06.2"
4 changes: 3 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
- Site support for Crunchyroll.com [2017.03.05]
- Fix for #1 [2017.03.06]
- Fix for #2 [2017.03.06]
- ReadMe updated for Python Script execution [2017.03.06]
- ReadMe updated for Python Script execution [2017.03.06]
- Support for Whole Show Downloading for Crunchyroll [2017.03.06]
- Selection of language for the Crunchyroll Show [2017.03.06]
10 changes: 9 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Anime-dl is a Command-line program to download anime from CrunchyRoll and Funima
* [Usage](#usage)
* [Windows](#windows)
* [Linux/Debian](#linuxdebian)
* [Example URLs](#example-urls)
* [Features](#features)
* [Changelog](https://github.com/Xonshiz/anime-dl/blob/master/Changelog.md)
* [Opening An Issue/Requesting A Site](#opening-an-issuerequesting-a-site)
Expand Down Expand Up @@ -76,7 +77,8 @@ Currently, the script supports these arguments :
-V,--version Prints the VERSION and exits.
-u,--username Indicates username for a website.
-p,--password Indicates password for a website.
-r,--resolution Indicates the desired resolution (default = 720p)
-r,--resolution Indicates the desired resolution. (default = 720p)
-l,--language Selects the language for the show. (default = Japanese) [Langs = english, dub, sub, Japanese, eng]
```

## Usage
Expand Down Expand Up @@ -110,6 +112,12 @@ After you've saved this script in a directory/folder, you need to open `command

URL can be any URL of the [supported websites](https://github.com/Xonshiz/anime-dl/blob/master/Supported_Sites.md).

### Example URLs
* Crunchyroll :
* Single Episode : [http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059](http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059)
* Whole Show : [http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying](http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying)


## Features
This is a very basic and small sript, so at the moment it only have a few features.
* Downloads a Single episode along with all the available subtitles for that episode.
Expand Down

0 comments on commit 8833c99

Please sign in to comment.