|
|
@ -462,6 +462,9 @@ class PixivRankingExtractor(PixivExtractor):
|
|
|
|
("https://www.pixiv.net/ranking.php?mode=daily&date=20170818"),
|
|
|
|
("https://www.pixiv.net/ranking.php?mode=daily&date=20170818"),
|
|
|
|
("https://www.pixiv.net/ranking.php"),
|
|
|
|
("https://www.pixiv.net/ranking.php"),
|
|
|
|
("https://touch.pixiv.net/ranking.php"),
|
|
|
|
("https://touch.pixiv.net/ranking.php"),
|
|
|
|
|
|
|
|
("https://www.pixiv.net/ranking.php?mode=unknown", {
|
|
|
|
|
|
|
|
"exception": exception.StopExtraction,
|
|
|
|
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, match):
|
|
|
|
def __init__(self, match):
|
|
|
@ -492,10 +495,10 @@ class PixivRankingExtractor(PixivExtractor):
|
|
|
|
"rookie": "week_rookie",
|
|
|
|
"rookie": "week_rookie",
|
|
|
|
"r18g": "week_r18g",
|
|
|
|
"r18g": "week_r18g",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if mode not in mode_map:
|
|
|
|
try:
|
|
|
|
self.log.warning("invalid mode '%s'", mode)
|
|
|
|
self.mode = mode = mode_map[mode]
|
|
|
|
mode = "daily"
|
|
|
|
except KeyError:
|
|
|
|
self.mode = mode_map[mode]
|
|
|
|
raise exception.StopExtraction("Invalid mode '%s'", mode)
|
|
|
|
|
|
|
|
|
|
|
|
date = query.get("date")
|
|
|
|
date = query.get("date")
|
|
|
|
if date:
|
|
|
|
if date:
|
|
|
@ -527,6 +530,15 @@ class PixivSearchExtractor(PixivExtractor):
|
|
|
|
"range": "1-10",
|
|
|
|
"range": "1-10",
|
|
|
|
"count": 10,
|
|
|
|
"count": 10,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
|
|
|
|
("https://pixiv.net/en/tags/foo/artworks?order=week&s_mode=s_tag", {
|
|
|
|
|
|
|
|
"exception": exception.StopExtraction,
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
("https://pixiv.net/en/tags/foo/artworks?order=date&s_mode=tag", {
|
|
|
|
|
|
|
|
"exception": exception.StopExtraction,
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
("https://www.pixiv.net/search.php?s_mode=s_tag&name=Original", {
|
|
|
|
|
|
|
|
"exception": exception.StopExtraction,
|
|
|
|
|
|
|
|
}),
|
|
|
|
("https://www.pixiv.net/en/tags/foo/artworks?order=date&s_mode=s_tag"),
|
|
|
|
("https://www.pixiv.net/en/tags/foo/artworks?order=date&s_mode=s_tag"),
|
|
|
|
("https://www.pixiv.net/search.php?s_mode=s_tag&word=Original"),
|
|
|
|
("https://www.pixiv.net/search.php?s_mode=s_tag&word=Original"),
|
|
|
|
("https://touch.pixiv.net/search.php?word=Original"),
|
|
|
|
("https://touch.pixiv.net/search.php?word=Original"),
|
|
|
@ -548,19 +560,20 @@ class PixivSearchExtractor(PixivExtractor):
|
|
|
|
if self.word:
|
|
|
|
if self.word:
|
|
|
|
self.word = text.unquote(self.word)
|
|
|
|
self.word = text.unquote(self.word)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if "word" not in query:
|
|
|
|
try:
|
|
|
|
|
|
|
|
self.word = query["word"]
|
|
|
|
|
|
|
|
except KeyError:
|
|
|
|
raise exception.StopExtraction("Missing search term")
|
|
|
|
raise exception.StopExtraction("Missing search term")
|
|
|
|
self.word = query["word"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sort = query.get("order", "date_d")
|
|
|
|
sort = query.get("order", "date_d")
|
|
|
|
sort_map = {
|
|
|
|
sort_map = {
|
|
|
|
"date": "date_asc",
|
|
|
|
"date": "date_asc",
|
|
|
|
"date_d": "date_desc",
|
|
|
|
"date_d": "date_desc",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if sort not in sort_map:
|
|
|
|
try:
|
|
|
|
self.log.warning("invalid sort order '%s'", sort)
|
|
|
|
self.sort = sort = sort_map[sort]
|
|
|
|
sort = "date_d"
|
|
|
|
except KeyError:
|
|
|
|
self.sort = sort_map[sort]
|
|
|
|
raise exception.StopExtraction("Invalid search order '%s'", sort)
|
|
|
|
|
|
|
|
|
|
|
|
target = query.get("s_mode", "s_tag_full")
|
|
|
|
target = query.get("s_mode", "s_tag_full")
|
|
|
|
target_map = {
|
|
|
|
target_map = {
|
|
|
@ -568,10 +581,10 @@ class PixivSearchExtractor(PixivExtractor):
|
|
|
|
"s_tag_full": "exact_match_for_tags",
|
|
|
|
"s_tag_full": "exact_match_for_tags",
|
|
|
|
"s_tc": "title_and_caption",
|
|
|
|
"s_tc": "title_and_caption",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if target not in target_map:
|
|
|
|
try:
|
|
|
|
self.log.warning("invalid search target '%s'", target)
|
|
|
|
self.target = target = target_map[target]
|
|
|
|
target = "s_tag_full"
|
|
|
|
except KeyError:
|
|
|
|
self.target = target_map[target]
|
|
|
|
raise exception.StopExtraction("Invalid search mode '%s'", target)
|
|
|
|
|
|
|
|
|
|
|
|
self.date_start = query.get("scd")
|
|
|
|
self.date_start = query.get("scd")
|
|
|
|
self.date_end = query.get("ecd")
|
|
|
|
self.date_end = query.get("ecd")
|
|
|
|