diff --git a/gallery_dl/extractor/fantia.py b/gallery_dl/extractor/fantia.py index f1d51e21e2c..8a59e096271 100644 --- a/gallery_dl/extractor/fantia.py +++ b/gallery_dl/extractor/fantia.py @@ -42,7 +42,11 @@ def items(self): post = self._get_post_data(post_id) post["num"] = 0 - for content in self._get_post_contents(post): + contents = self._get_post_contents(post) + post["content_count"] = len(contents) + post["content_num"] = 0 + + for content in contents: files = self._process_content(post, content) yield Message.Directory, post @@ -131,6 +135,7 @@ def _process_content(self, post, content): post["content_filename"] = content.get("filename") or "" post["content_id"] = content["id"] post["content_comment"] = content.get("comment") or "" + post["content_num"] += 1 post["plan"] = content["plan"] or self._empty_plan files = [] diff --git a/test/results/fantia.py b/test/results/fantia.py index 706b89d6e5c..70773fb022a 100644 --- a/test/results/fantia.py +++ b/test/results/fantia.py @@ -27,12 +27,12 @@ "#pattern" : r"https://(c\.fantia\.jp/uploads/post/file/1166373/|cc\.fantia\.jp/uploads/post_content_photo/file/732549[01]|fantia\.jp/posts/1166373/album_image\?)", "blogpost_text" : r"re:^$|This is a test.\n\nThis is a test.\n\n|Link to video:\nhttps://www.youtube.com/watch\?v=5SSdvNcAagI\n\nhtml img from another site:\n\n\n\n\n\n", - "comment" : """ - -""", + "comment" : "\n\n", "content_category": r"re:thumb|blog|photo_gallery", "content_comment" : str, + "content_count" : 5, "content_filename": r"re:|", + "content_num" : range(1, 5), "content_title" : r"re:Test (Blog Content \d+|Image Gallery)|thumb", "date" : "dt:2022-03-09 16:46:12", "fanclub_id" : 356320, @@ -56,7 +56,7 @@ "#url" : "https://fantia.jp/posts/508363", "#category": ("", "fantia", "post"), "#class" : fantia.FantiaPostExtractor, - "#count" : 6, + "#count" : 0, "post_title": "zunda逆バニーでおしりコッショリ", "tags" : list,