This repository has been archived by the owner on Oct 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Girbons/development
Added support for mangahere
- Loading branch information
Showing
13 changed files
with
120 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__title__ = 'comics-downloader' | ||
__autor__ = 'Alessandro De Angelis' | ||
__version__ = '0.4.1' | ||
__version__ = '0.5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .comicextra import ComicExtra # noqa | ||
from .mangahere import MangaHere # noqa | ||
from .mangareader import MangaReader # noqa | ||
from .readcomiconline import ReadComicOnline # noqa | ||
from .readcomicsio import ReadComics # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import re | ||
|
||
import requests | ||
|
||
from bs4 import BeautifulSoup | ||
|
||
from ..core.comics import BaseComics | ||
from ..utils import is_url_valid | ||
|
||
|
||
class MangaHere(BaseComics): | ||
""" | ||
class for http://www.mangahere.cc/ | ||
""" | ||
def __init__(self, url): | ||
self.base_url = 'http://www.mangahere.cc/' | ||
self._image_regex = r'<img[^>]+src="([^">]+)"' | ||
self.antibot = False | ||
super(MangaHere, self).__init__(url) | ||
|
||
@property | ||
def name(self): | ||
return self.splitted_url[4] | ||
|
||
@property | ||
def issue_number(self): | ||
return self.splitted_url[5] | ||
|
||
def images_links(self, response): | ||
session = requests.Session() | ||
soup = BeautifulSoup(response.content, 'html.parser') | ||
# retrieve the <options> in page | ||
options = soup.findAll('option') | ||
links = [] | ||
|
||
for option in options: | ||
links.append('http:{}'.format(option['value'])) | ||
|
||
images_links = [] | ||
for link in links: | ||
response = session.get(link) | ||
image_url = re.findall(self._image_regex, response.text)[1] | ||
if is_url_valid(image_url): | ||
images_links.append(image_url) | ||
|
||
return images_links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import os | ||
|
||
|
||
from comics.utils import create_and_change_dir | ||
from comics.utils import create_and_change_dir, is_url_valid | ||
|
||
|
||
def test_create_and_change(): | ||
create_and_change_dir('test_dir') | ||
current_wd = os.getcwd() | ||
assert 'test_dir' in current_wd | ||
os.removedirs(current_wd) | ||
|
||
|
||
def test_valid_url(): | ||
assert is_url_valid('http://example.com') is True | ||
assert is_url_valid('http://foo.gif') is False | ||
assert is_url_valid('aaaaaa') is False |