[furaffinity] extract 'scraps' metadata (#7015)

boolean value indicating whether a post is part of a user's Scraps
folder or the main gallery
This commit is contained in:
Mike Fährmann
2025-03-12 16:29:16 +01:00
parent a12ff281e7
commit e1bdcd97e1
2 changed files with 31 additions and 1 deletions

View File

@@ -97,6 +97,7 @@ class FuraffinityExtractor(Extractor):
if self._new_layout:
data["tags"] = text.split_html(extr(
'class="tags-row">', '</section>'))
data["scraps"] = (extr(' submissions">', "<") == "Scraps")
data["title"] = text.unescape(extr("<h2><p>", "</p></h2>"))
data["artist_url"] = extr('title="', '"').strip()
data["artist"] = extr(">", "<")
@@ -121,6 +122,8 @@ class FuraffinityExtractor(Extractor):
folders.append(folder)
else:
# old site layout
data["scraps"] = (
"/scraps/" in extr('class="minigallery-title', "</a>"))
data["title"] = text.unescape(extr("<h2>", "</h2>"))
data["artist_url"] = extr('title="', '"').strip()
data["artist"] = extr(">", "<")

View File

@@ -98,6 +98,7 @@ __tests__ = (
"gender" : "Any",
"width" : 120,
"height" : 120,
"scraps" : False,
},
{
@@ -168,12 +169,38 @@ __tests__ = (
"Custom Character Folder - Other Ungulates",
"Custom Character Folder - Female",
"Custom Character Folder - Patreon Supported Custom Characters"],
"height" : 900,
"id" : 34260156,
"rating" : "General",
"title" : "Patreon Custom Deer",
"thumbnail" : "https://t.furaffinity.net/34260156@600-1576623121.jpg",
"width" : 488,
"height" : 900,
"scraps" : False,
},
{
"#url" : "https://www.furaffinity.net/view/4919026/",
"#comment" : "'scraps' metadata (#7015)",
"#category": ("", "furaffinity", "post"),
"#class" : furaffinity.FuraffinityPostExtractor,
"#auth" : False,
"id" : 4919026,
"scraps" : True,
"title" : "Loth Color Test",
"rating" : "General",
"theme" : "Fantasy",
"species" : "Dragon (Other)",
"gender" : "Multiple characters",
"width" : 600,
"height" : 777,
"user" : "mirlinthloth",
"date" : "dt:2010-12-10 01:47:23",
"description": "I think this is the first coloring for Loth that I did, I loved the goofy expression so I kept it.",
"folders": [
"Mirlinth Loth",
"Akiric Works",
],
},
{