mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-21 18:22:30 +01:00
[ao3] fix bookmark extraction, support 'series' bookmarks (#6013)
This commit is contained in:
parent
5c062f95c1
commit
8bf081d295
@ -282,3 +282,21 @@ class Ao3UserBookmarkExtractor(Ao3Extractor):
|
||||
pattern = (BASE_PATTERN + r"(/users/([^/?#]+)/(?:pseuds/([^/?#]+)/)?"
|
||||
r"bookmarks(?:/?\?.+)?)")
|
||||
example = "https://archiveofourown.org/users/USER/bookmarks"
|
||||
|
||||
def items(self):
|
||||
self.login()
|
||||
|
||||
base = self.root + "/"
|
||||
data_work = {"_extractor": Ao3WorkExtractor}
|
||||
data_series = {"_extractor": Ao3SeriesExtractor}
|
||||
|
||||
for item in self._pagination(
|
||||
self.groups[0], '<span class="count"><a href="/'):
|
||||
path = item.rpartition("/")[0]
|
||||
url = base + path
|
||||
if item.startswith("works/"):
|
||||
yield Message.Queue, url, data_work
|
||||
elif item.startswith("series/"):
|
||||
yield Message.Queue, url, data_series
|
||||
else:
|
||||
self.log.warning("Unsupported bookmark type '%s'", path)
|
||||
|
@ -236,7 +236,7 @@ __tests__ = (
|
||||
"#url" : "https://archiveofourown.org/users/Fyrelass/bookmarks",
|
||||
"#category": ("", "ao3", "user-bookmark"),
|
||||
"#class" : ao3.Ao3UserBookmarkExtractor,
|
||||
"#pattern" : ao3.Ao3WorkExtractor.pattern,
|
||||
"#pattern" : r"https://archiveofourown\.org/(work|serie)s/\d+",
|
||||
"#range" : "1-50",
|
||||
"#count" : 50,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user