Skip to content

Commit

Permalink
merge #5824: [furaffinity] add 'folders' and 'thumbnail' (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jul 17, 2024
2 parents 60a2fef + 9a8ec95 commit 026e0b9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gallery_dl/extractor/furaffinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ def _parse_post(self, post_id):
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>"))
Expand All @@ -132,11 +138,14 @@ def _parse_post(self, post_id):
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

Expand Down
44 changes: 44 additions & 0 deletions test/results/furaffinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,50 @@
"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"),
Expand Down

0 comments on commit 026e0b9

Please sign in to comment.