diff --git a/gallery_dl/extractor/ao3.py b/gallery_dl/extractor/ao3.py index 15af2ee6b1..fae382c0a9 100644 --- a/gallery_dl/extractor/ao3.py +++ b/gallery_dl/extractor/ao3.py @@ -116,6 +116,19 @@ def items(self): } data["language"] = util.code_to_language(data["lang"]) + series = data["series"] + if series: + extr = text.extract_from(series) + data["series"] = { + "prev" : extr(' class="previous" href="/works/', '"'), + "index": extr(' class="position">Part ', " "), + "id" : extr(' href="/series/', '"'), + "name" : text.unescape(extr(">", "<")), + "next" : extr(' class="next" href="/works/', '"'), + } + else: + data["series"] = None + yield Message.Directory, data for fmt in self.formats: try: diff --git a/test/results/ao3.py b/test/results/ao3.py index 5622d845d0..9decc005eb 100644 --- a/test/results/ao3.py +++ b/test/results/ao3.py @@ -25,6 +25,13 @@ "lang" : "en", "language" : "English", "likes" : range(1000, 2000), + "series" : { + "id" : "4237024", + "prev" : "", + "next" : "57205801", + "index": "1", + "name" : "The Wildcard Universe", + }, "title" : "The Wildcard", "views" : range(34000, 50000), "words" : 217549, @@ -172,6 +179,7 @@ "#category": ("", "ao3", "user-works"), "#class" : ao3.Ao3UserWorksExtractor, "#urls" : ( + "https://archiveofourown.org/works/58979287", "https://archiveofourown.org/works/55035061", "https://archiveofourown.org/works/52704457", "https://archiveofourown.org/works/52502743",