[pixiv] add 'novel-bookmark' extractor (#4111)
This commit is contained in:
@@ -664,7 +664,7 @@ Consider all sites to be NSFW unless otherwise known.
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Pixiv</td>
|
<td>Pixiv</td>
|
||||||
<td>https://www.pixiv.net/</td>
|
<td>https://www.pixiv.net/</td>
|
||||||
<td>Artworks, Avatars, Backgrounds, Favorites, Follows, pixiv.me Links, Novels, Novel Series, pixivision, Rankings, Search Results, Series, Sketch, User Profiles, individual Images</td>
|
<td>Artworks, Avatars, Backgrounds, Favorites, Follows, pixiv.me Links, Novels, Novel Bookmarks, Novel Series, pixivision, Rankings, Search Results, Series, Sketch, User Profiles, individual Images</td>
|
||||||
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
|
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -168,11 +168,12 @@ class PixivUserExtractor(PixivExtractor):
|
|||||||
def items(self):
|
def items(self):
|
||||||
base = "{}/users/{}/".format(self.root, self.user_id)
|
base = "{}/users/{}/".format(self.root, self.user_id)
|
||||||
return self._dispatch_extractors((
|
return self._dispatch_extractors((
|
||||||
(PixivAvatarExtractor , base + "avatar"),
|
(PixivAvatarExtractor , base + "avatar"),
|
||||||
(PixivBackgroundExtractor, base + "background"),
|
(PixivBackgroundExtractor , base + "background"),
|
||||||
(PixivArtworksExtractor , base + "artworks"),
|
(PixivArtworksExtractor , base + "artworks"),
|
||||||
(PixivFavoriteExtractor , base + "bookmarks/artworks"),
|
(PixivFavoriteExtractor , base + "bookmarks/artworks"),
|
||||||
(PixivNovelUserExtractor , base + "novels"),
|
(PixivNovelBookmarkExtractor, base + "bookmarks/novels"),
|
||||||
|
(PixivNovelUserExtractor , base + "novels"),
|
||||||
), ("artworks",))
|
), ("artworks",))
|
||||||
|
|
||||||
|
|
||||||
@@ -799,6 +800,7 @@ class PixivNovelExtractor(PixivExtractor):
|
|||||||
"options": (("embeds", True),),
|
"options": (("embeds", True),),
|
||||||
"count": 3,
|
"count": 3,
|
||||||
}),
|
}),
|
||||||
|
# short URL
|
||||||
("https://www.pixiv.net/n/19612040"),
|
("https://www.pixiv.net/n/19612040"),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -927,6 +929,38 @@ class PixivNovelSeriesExtractor(PixivNovelExtractor):
|
|||||||
return self.api.novel_series(self.novel_id)
|
return self.api.novel_series(self.novel_id)
|
||||||
|
|
||||||
|
|
||||||
|
class PixivNovelBookmarkExtractor(PixivNovelExtractor):
|
||||||
|
"""Extractor for bookmarked pixiv novels"""
|
||||||
|
subcategory = "novel-bookmark"
|
||||||
|
pattern = (r"(?:https?://)?(?:www\.|touch\.)?pixiv\.net"
|
||||||
|
r"/(?:en/)?users/(\d+)/bookmarks/novels"
|
||||||
|
r"(?:/([^/?#]+))?(?:/?\?([^#]+))?")
|
||||||
|
test = (
|
||||||
|
("https://www.pixiv.net/en/users/77055466/bookmarks/novels", {
|
||||||
|
"count": 1,
|
||||||
|
"content": "7194e8faa876b2b536f185ee271a2b6e46c69089",
|
||||||
|
}),
|
||||||
|
("https://www.pixiv.net/en/users/11/bookmarks/novels/TAG?rest=hide"),
|
||||||
|
)
|
||||||
|
|
||||||
|
def __init__(self, match):
|
||||||
|
PixivNovelExtractor.__init__(self, match)
|
||||||
|
self.user_id, self.tag, self.query = match.groups()
|
||||||
|
|
||||||
|
def novels(self):
|
||||||
|
if self.tag:
|
||||||
|
tag = text.unquote(self.tag)
|
||||||
|
else:
|
||||||
|
tag = None
|
||||||
|
|
||||||
|
if text.parse_query(self.query).get("rest") == "hide":
|
||||||
|
restrict = "private"
|
||||||
|
else:
|
||||||
|
restrict = "public"
|
||||||
|
|
||||||
|
return self.api.user_bookmarks_novel(self.user_id, tag, restrict)
|
||||||
|
|
||||||
|
|
||||||
class PixivSketchExtractor(Extractor):
|
class PixivSketchExtractor(Extractor):
|
||||||
"""Extractor for user pages on sketch.pixiv.net"""
|
"""Extractor for user pages on sketch.pixiv.net"""
|
||||||
category = "pixiv"
|
category = "pixiv"
|
||||||
@@ -1113,6 +1147,11 @@ class PixivAppAPI():
|
|||||||
params = {"user_id": user_id, "tag": tag, "restrict": restrict}
|
params = {"user_id": user_id, "tag": tag, "restrict": restrict}
|
||||||
return self._pagination("/v1/user/bookmarks/illust", params)
|
return self._pagination("/v1/user/bookmarks/illust", params)
|
||||||
|
|
||||||
|
def user_bookmarks_novel(self, user_id, tag=None, restrict="public"):
|
||||||
|
"""Return novels bookmarked by a user"""
|
||||||
|
params = {"user_id": user_id, "tag": tag, "restrict": restrict}
|
||||||
|
return self._pagination("/v1/user/bookmarks/novel", params, "novels")
|
||||||
|
|
||||||
def user_bookmark_tags_illust(self, user_id, restrict="public"):
|
def user_bookmark_tags_illust(self, user_id, restrict="public"):
|
||||||
"""Return bookmark tags defined by a user"""
|
"""Return bookmark tags defined by a user"""
|
||||||
params = {"user_id": user_id, "restrict": restrict}
|
params = {"user_id": user_id, "restrict": restrict}
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
__version__ = "1.25.5"
|
__version__ = "1.25.6-dev"
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ SUBCATEGORY_MAP = {
|
|||||||
},
|
},
|
||||||
"pixiv": {
|
"pixiv": {
|
||||||
"me" : "pixiv.me Links",
|
"me" : "pixiv.me Links",
|
||||||
|
"novel-bookmark": "Novel Bookmarks",
|
||||||
"novel-series": "Novel Series",
|
"novel-series": "Novel Series",
|
||||||
"novel-user": "",
|
"novel-user": "",
|
||||||
"pixivision": "pixivision",
|
"pixivision": "pixivision",
|
||||||
|
|||||||
Reference in New Issue
Block a user