[fantia] add 'content_count' and 'content_num' metadata fields (#4627)
This commit is contained in:
@@ -42,7 +42,11 @@ class FantiaExtractor(Extractor):
|
|||||||
post = self._get_post_data(post_id)
|
post = self._get_post_data(post_id)
|
||||||
post["num"] = 0
|
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)
|
files = self._process_content(post, content)
|
||||||
yield Message.Directory, post
|
yield Message.Directory, post
|
||||||
|
|
||||||
@@ -131,6 +135,7 @@ class FantiaExtractor(Extractor):
|
|||||||
post["content_filename"] = content.get("filename") or ""
|
post["content_filename"] = content.get("filename") or ""
|
||||||
post["content_id"] = content["id"]
|
post["content_id"] = content["id"]
|
||||||
post["content_comment"] = content.get("comment") or ""
|
post["content_comment"] = content.get("comment") or ""
|
||||||
|
post["content_num"] += 1
|
||||||
post["plan"] = content["plan"] or self._empty_plan
|
post["plan"] = content["plan"] or self._empty_plan
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ __tests__ = (
|
|||||||
"#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\?)",
|
"#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",
|
"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_category": r"re:thumb|blog|photo_gallery",
|
||||||
"content_comment" : str,
|
"content_comment" : str,
|
||||||
|
"content_count" : 5,
|
||||||
"content_filename": r"re:|",
|
"content_filename": r"re:|",
|
||||||
|
"content_num" : range(1, 5),
|
||||||
"content_title" : r"re:Test (Blog Content \d+|Image Gallery)|thumb",
|
"content_title" : r"re:Test (Blog Content \d+|Image Gallery)|thumb",
|
||||||
"date" : "dt:2022-03-09 16:46:12",
|
"date" : "dt:2022-03-09 16:46:12",
|
||||||
"fanclub_id" : 356320,
|
"fanclub_id" : 356320,
|
||||||
@@ -56,7 +56,7 @@ __tests__ = (
|
|||||||
"#url" : "https://fantia.jp/posts/508363",
|
"#url" : "https://fantia.jp/posts/508363",
|
||||||
"#category": ("", "fantia", "post"),
|
"#category": ("", "fantia", "post"),
|
||||||
"#class" : fantia.FantiaPostExtractor,
|
"#class" : fantia.FantiaPostExtractor,
|
||||||
"#count" : 6,
|
"#count" : 0,
|
||||||
|
|
||||||
"post_title": "zunda逆バニーでおしりコッショリ",
|
"post_title": "zunda逆バニーでおしりコッショリ",
|
||||||
"tags" : list,
|
"tags" : list,
|
||||||
|
|||||||
Reference in New Issue
Block a user