Skip to content

Commit

Permalink
[mangapark] fix image URLs and use HTTPS
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jan 12, 2018
1 parent 9a049bd commit 35e0986
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- `puremashiro` - http://reader.puremashiro.moe/ ([#66](https://github.com/mikf/gallery-dl/issues/66))
- `idolcomplex` - https://idol.sankakucomplex.com/
- Added an option to filter reblogs on `tumblr` ([#61](https://github.com/mikf/gallery-dl/issues/61))
- Added OAuth user authentication for `tumblr` ([#65](https://github.com/mikf/gallery-dl/issues/65))
- Added support for `slideshare` mobile URLs ([#67](https://github.com/mikf/gallery-dl/issues/67))
- Improved pagination for various …booru sites to work around page limits
- Fixed chapter information parsing for certain manga on `kissmanga` ([#58](https://github.com/mikf/gallery-dl/issues/58)) and `batoto` ([#60](https://github.com/mikf/gallery-dl/issues/60))

Expand Down
4 changes: 2 additions & 2 deletions docs/supportedsites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Manga Fox http://www.mangafox.me/ Chapters
Manga Here http://www.mangahere.co/ Chapters, Manga
Manga Stream https://mangastream.com/ Chapters
Mangapanda http://www.mangapanda.com/ Chapters, Manga
MangaPark http://mangapark.me/ Chapters, Manga
MangaPark https://mangapark.me/ Chapters, Manga
Mangareader http://www.mangareader.net/ Chapters, Manga
nhentai https://nhentai.net/ Galleries
Niconico Seiga http://seiga.nicovideo.jp Images from Users, individual Images Required
Expand All @@ -71,7 +71,7 @@ Sense-Scans http://sensescans.com/ Chapters, Manga
SlideShare https://www.slideshare.net/ Presentations
Spectrum Nexus |http://www.thes-0| Chapters, Manga
The /b/ Archive https://thebarchive.com/ Threads
Tumblr https://www.tumblr.com/ Images from Users, Posts, Tag-Searches Optional (OAuth)
Tumblr https://www.tumblr.com/ Images from Users, Likes, Posts, Tag-Searches Optional (OAuth)
Twitter https://twitter.com/ Tweets
Warosu https://warosu.org/ Threads
World Three http://www.slide.world-three.org/ Chapters, Manga
Expand Down
28 changes: 14 additions & 14 deletions gallery_dl/extractor/mangapark.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# -*- coding: utf-8 -*-

# Copyright 2015-2017 Mike Fährmann
# Copyright 2015-2018 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

"""Extract manga-chapters and entire manga from http://mangapark.me/"""
"""Extract manga-chapters and entire manga from https://mangapark.me/"""

from .common import Extractor, MangaExtractor, Message
from .. import text, util
from urllib.parse import urljoin


class MangaparkExtractor(Extractor):
"""Base class for mangapark extractors"""
category = "mangapark"
root = "http://mangapark.me"
root = "https://mangapark.me"

@staticmethod
def parse_chapter_path(path, data):
Expand All @@ -38,9 +39,9 @@ def parse_chapter_path(path, data):
class MangaparkMangaExtractor(MangaparkExtractor, MangaExtractor):
"""Extractor for manga from mangapark.me"""
pattern = [r"(?:https?://)?(?:www\.)?(mangapark\.me/manga/[^/]+)/?$"]
test = [("http://mangapark.me/manga/aria", {
"url": "0c5a57e2b402c8cc9ceefba82619f6280346f984",
"keyword": "75a68497d1f305eaf9b9fec235bd1da6e499546f",
test = [("https://mangapark.me/manga/aria", {
"url": "4cb5606530b4eeacde7a4c9fd38296eb6ff46563",
"keyword": "e87ab8e7ad2571bbe587881e7fd422e8f582f818",
})]

def chapters(self, page):
Expand Down Expand Up @@ -78,16 +79,16 @@ class MangaparkChapterExtractor(MangaparkExtractor):
pattern = [(r"(?:https?://)?(?:www\.)?mangapark\.me(/manga/[^/]+"
r"/s\d+(?:/v\d+)?/c\d+[^/]*(?:/e\d+)?)")]
test = [
("http://mangapark.me/manga/gosu/s2/c55", {
("https://mangapark.me/manga/gosu/s2/c55", {
"count": 50,
"keyword": "72ac1714b492b021a1fe26d9271ed132d51a930e",
}),
(("http://mangapark.me/manga/"
"ad-astra-per-aspera-hata-kenjirou/s1/c1.2"), {
(("https://mangapark.me/manga/"
"ad-astra-per-aspera-hata-kenjirou/s5/c1.2"), {
"count": 40,
"keyword": "0ac6a028f6479b2ecfe7b2d014074a0aea027e90",
"keyword": "fb5082bb60e19cae0a194b89f69f333888a9325d",
}),
("http://mangapark.me/manga/gekkan-shoujo-nozaki-kun/s2/c70/e2/1", {
("https://mangapark.me/manga/gekkan-shoujo-nozaki-kun/s2/c70/e2/1", {
"count": 15,
"keyword": "dc9233cdd83d8659300f0a20ec3c493873f71741",
}),
Expand Down Expand Up @@ -124,8 +125,7 @@ def get_job_metadata(self, page):
data["count"] = util.safe_int(data["count"])
return data

@staticmethod
def get_images(page):
def get_images(self, page):
"""Collect image-urls, -widths and -heights"""
pos = 0
num = 0
Expand All @@ -136,7 +136,7 @@ def get_images(page):
num += 1
width , pos = text.extract(page, ' width="', '"', pos)
height, pos = text.extract(page, ' _heighth="', '"', pos)
yield url, {
yield urljoin(self.root, url), {
"page": num,
"width": width,
"height": height,
Expand Down
8 changes: 6 additions & 2 deletions scripts/build_supportedsites.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def _format_row(self, row):

_subs = []


def substitute(value, size):
sub = "|{}-{}|".format(value[:15], len(_subs))
_subs.append((value, sub))
Expand All @@ -180,7 +181,7 @@ def build_list():
for extrlist in extractors:
extrlist.sort(key=subcategory_key)
for extr in extrlist:
extr.cat = map_category(extr.category)
extr.cat = map_category(extr.category)
extr.subcat = map_subcategory(extr.subcategory)
extractors.sort(key=category_key)

Expand All @@ -206,7 +207,10 @@ def map_category(c):


def map_subcategory(sc):
return SUBCATEGORY_MAP.get(sc, sc.capitalize() + "s")
if sc in SUBCATEGORY_MAP:
return SUBCATEGORY_MAP[sc]
sc = sc.capitalize()
return sc if sc.endswith("s") else sc + "s"


def category_key(extrlist):
Expand Down
3 changes: 1 addition & 2 deletions test/test_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
# temporary issues
"batoto", # R.I.P.
"imgyt", # server maintenance
"loveisover",
"mangapark",
"luscious",
}


Expand Down

0 comments on commit 35e0986

Please sign in to comment.