1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 03:02:50 +01:00

[pixiv] support mobile URLs (https://touch.pixiv.net/)

This commit is contained in:
Mike Fährmann 2017-10-17 16:49:42 +02:00
parent ab2bf0b0dd
commit 4d8387f93b
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 26 additions and 17 deletions

View File

@ -10,7 +10,6 @@ import re
import importlib
modules = [
"pixiv",
"2chan",
"3dbooru",
"4chan",
@ -63,6 +62,7 @@ modules = [
"nyafuu",
"pawoo",
"pinterest",
"pixiv",
"powermanga",
"readcomiconline",
"rebeccablacktech",

View File

@ -119,10 +119,10 @@ class PixivExtractor(Extractor):
class PixivUserExtractor(PixivExtractor):
"""Extractor for works of a pixiv-user"""
subcategory = "user"
pattern = [(r"(?:https?://)?(?:www\.)?pixiv\.net/"
r"member(?:_illust)?\.php\?id=(\d+)(?:.*&tag=([^&#]+))?"),
(r"(?:https?://)?(?:www\.)?pixiv\.net/"
r"(?:u/|(?:mypage\.php)?#id=)(\d+)()")]
pattern = [(r"(?:https?://)?(?:www\.|touch\.)?pixiv\.net"
r"/member(?:_illust)?\.php\?id=(\d+)(?:.*&tag=([^&#]+))?"),
(r"(?:https?://)?(?:www\.|touch\.)?pixiv\.net"
r"/(?:u/|(?:mypage\.php)?#id=)(\d+)()")]
test = [
("http://www.pixiv.net/member_illust.php?id=173530", {
"url": "852c31ad83b6840bacbce824d85f2a997889efb7",
@ -137,6 +137,7 @@ class PixivUserExtractor(PixivExtractor):
("https://www.pixiv.net/u/173530", None),
("https://www.pixiv.net/mypage.php#id=173530", None),
("https://www.pixiv.net/#id=173530", None),
("https://touch.pixiv.net/member_illust.php?id=173530", None),
]
def __init__(self, match):
@ -183,10 +184,10 @@ class PixivMeExtractor(PixivExtractor):
class PixivWorkExtractor(PixivExtractor):
"""Extractor for a single pixiv work/illustration"""
subcategory = "work"
pattern = [(r"(?:https?://)?(?:www\.)?pixiv\.net/member(?:_illust)?\.php"
r"\?(?:[^&]+&)*illust_id=(\d+)"),
(r"(?:https?://)?i(?:\d+\.pixiv|\.pximg)\.net/"
r"(?:(?:.*/)?img-[^/]+/img/\d{4}(?:/\d\d){5}"
pattern = [(r"(?:https?://)?(?:www\.|touch\.)?pixiv\.net"
r"/member(?:_illust)?\.php\?(?:[^&]+&)*illust_id=(\d+)"),
(r"(?:https?://)?i(?:\d+\.pixiv|\.pximg)\.net"
r"/(?:(?:.*/)?img-[^/]+/img/\d{4}(?:/\d\d){5}"
r"|img\d+/img/[^/]+)/(\d+)"),
(r"(?:https?://)?img\d*\.pixiv\.net/img/[^/]+/(\d+)"),
(r"(?:https?://)?(?:www\.)?pixiv\.net/i/(\d+)")]
@ -231,10 +232,14 @@ class PixivFavoriteExtractor(PixivExtractor):
"""Extractor for all favorites/bookmarks of a pixiv-user"""
subcategory = "favorite"
directory_fmt = ["{category}", "bookmarks", "{user[id]} {user[account]}"]
pattern = [r"(?:https?://)?(?:www\.)?pixiv\.net/bookmark\.php\?id=(\d+)"]
test = [("http://www.pixiv.net/bookmark.php?id=173530", {
pattern = [r"(?:https?://)?(?:www\.|touch\.)?pixiv\.net"
r"/bookmark\.php\?id=(\d+)"]
test = [
("https://www.pixiv.net/bookmark.php?id=173530", {
"url": "e717eb511500f2fa3497aaee796a468ecf685cc4",
})]
}),
("https://touch.pixiv.net/bookmark.php?id=173530", None),
]
def __init__(self, match):
PixivExtractor.__init__(self)
@ -250,8 +255,11 @@ class PixivFavoriteExtractor(PixivExtractor):
class PixivBookmarkExtractor(PixivFavoriteExtractor):
"""Extractor for all favorites/bookmarks of your own account"""
subcategory = "bookmark"
pattern = [r"(?:https?://)?(?:www\.)?pixiv\.net/bookmark\.php()$"]
test = [("https://www.pixiv.net/bookmark.php", None)]
pattern = [r"(?:https?://)?(?:www\.|touch\.)?pixiv\.net/bookmark\.php()$"]
test = [
("https://www.pixiv.net/bookmark.php", None),
("https://touch.pixiv.net/bookmark.php", None),
]
def get_metadata(self, user=None):
self.api.login()
@ -264,12 +272,13 @@ class PixivRankingExtractor(PixivExtractor):
"""Extractor for pixiv ranking pages"""
subcategory = "ranking"
directory_fmt = ["{category}", "rankings", "{mode}", "{date}"]
pattern = [r"(?:https?://)?(?:www\.)?pixiv\.net/"
r"ranking\.php(?:\?([^#]*))?"]
pattern = [r"(?:https?://)?(?:www\.|touch\.)?pixiv\.net"
r"/ranking\.php(?:\?([^#]*))?"]
test = [
(("https://www.pixiv.net/ranking.php"
"?mode=daily&content=illust&date=20170818"), None),
("https://www.pixiv.net/ranking.php", None),
("https://touch.pixiv.net/ranking.php", None),
]
def __init__(self, match):