merge #5824: [furaffinity] add 'folders' and 'thumbnail' (#1284)

pull/5870/head
Mike Fährmann 2 months ago
commit 026e0b97db
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -113,6 +113,12 @@ class FuraffinityExtractor(Extractor):
data["gender"] = rh(extr('>Gender</strong>', '</div>'))
data["width"] = pi(extr("<span>", "x"))
data["height"] = pi(extr("", "p"))
data["folders"] = folders = []
for folder in extr(
"<h3>Listed in Folders</h3>", "</section>").split("</a>"):
folder = rh(folder)
if folder:
folders.append(folder)
else:
# old site layout
data["title"] = text.unescape(extr("<h2>", "</h2>"))
@ -132,11 +138,14 @@ class FuraffinityExtractor(Extractor):
data["_description"] = extr(
'<td valign="top" align="left" width="70%" class="alt1" '
'style="padding:8px">', ' </td>')
data["folders"] = () # folders not present in old layout
data["artist_url"] = data["artist"].replace("_", "").lower()
data["user"] = self.user or data["artist_url"]
data["date"] = text.parse_timestamp(data["filename"].partition(".")[0])
data["description"] = self._process_description(data["_description"])
data["thumbnail"] = "https://t.furaffinity.net/{}@600-{}.jpg".format(
post_id, path.rsplit("/", 2)[1])
return data

@ -115,6 +115,50 @@ __tests__ = (
"width" : 1280,
},
{
"#url" : "https://www.furaffinity.net/view/22964019/",
"#comment" : "get thumbnails for posts (#1284)",
"#category": ("", "furaffinity", "post"),
"#class" : furaffinity.FuraffinityPostExtractor,
"artist" : "Dwale",
"artist_url" : "dwale",
"date" : "dt:2017-03-21 14:21:29",
"fa_category" : "Poetry",
"filename" : "1490106089.dwale_poem_for_children",
"folders" : [],
"height" : 50,
"id" : 22964019,
"rating" : "General",
"title" : "Poem for Children Wishing to Summon Evil Spirits",
"thumbnail" : "https://t.furaffinity.net/22964019@600-1490106089.jpg",
"width" : 50,
},
{
"#url" : "https://www.furaffinity.net/view/34260156/",
"#comment" : "list gallery folders for image",
"#category": ("", "furaffinity", "post"),
"#class" : furaffinity.FuraffinityPostExtractor,
"artist" : "dbd",
"artist_url" : "dbd",
"date" : "dt:2019-12-17 22:52:01",
"fa_category" : "All",
"filename" : "1576623121.dbd_patreoncustom-wdg13-web",
"folders" : ["By Year - 2019",
"Custom Character Folder - All Custom Characters",
"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,
},
{
"#url" : "https://furaffinity.net/view/21835115/",
"#category": ("", "furaffinity", "post"),

Loading…
Cancel
Save