From e1bdcd97e1a4edfccea3f1bafe5ca7e9e5f1daba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 12 Mar 2025 16:29:16 +0100 Subject: [PATCH] [furaffinity] extract 'scraps' metadata (#7015) boolean value indicating whether a post is part of a user's Scraps folder or the main gallery --- gallery_dl/extractor/furaffinity.py | 3 +++ test/results/furaffinity.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/furaffinity.py b/gallery_dl/extractor/furaffinity.py index b6ae1b1d..565fd711 100644 --- a/gallery_dl/extractor/furaffinity.py +++ b/gallery_dl/extractor/furaffinity.py @@ -97,6 +97,7 @@ class FuraffinityExtractor(Extractor): if self._new_layout: data["tags"] = text.split_html(extr( 'class="tags-row">', '')) + data["scraps"] = (extr(' submissions">', "<") == "Scraps") data["title"] = text.unescape(extr("

", "

")) 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', "")) data["title"] = text.unescape(extr("

", "

")) data["artist_url"] = extr('title="', '"').strip() data["artist"] = extr(">", "<") diff --git a/test/results/furaffinity.py b/test/results/furaffinity.py index a25609fe..eccdca46 100644 --- a/test/results/furaffinity.py +++ b/test/results/furaffinity.py @@ -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", + ], }, {