Skip to content

Commit

Permalink
[fantia] add 'content_count' and 'content_num' metadata fields (#4627)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Oct 13, 2023
1 parent 2d41702 commit 833dce1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion gallery_dl/extractor/fantia.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = []
Expand Down
8 changes: 4 additions & 4 deletions test/results/fantia.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 833dce1

Please sign in to comment.