mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
[furaffinity] Add 'thumbnail' (#1284) and 'folders' properties
Retrieve 'thumbnail' and 'folders' properties for each post. 'thumbnail' (#1284): - Preview image used for search results, writing posts, music, etc. - Filename format: <post_id>@600-<directory_containing_full_image>.jpg 'Folders' (related to #1817): - A list of all gallery folders containing this post - Folder name format: [<folder_category> - ]<folder_name> - Only works on new layout; old layout does not show folders, so list will be empty A test is included for each property.
This commit is contained in:
parent
e03b99ba0e
commit
f43bccb5be
@ -113,6 +113,9 @@ class FuraffinityExtractor(Extractor):
|
||||
data["gender"] = rh(extr('>Gender</strong>', '</div>'))
|
||||
data["width"] = pi(extr("<span>", "x"))
|
||||
data["height"] = pi(extr("", "p"))
|
||||
data["folders"] = [rh(folder) for folder in extr(
|
||||
'<h3>Listed in Folders</h3>',
|
||||
'</section>').split('</a>') if rh(folder) != '']
|
||||
else:
|
||||
# old site layout
|
||||
data["title"] = text.unescape(extr("<h2>", "</h2>"))
|
||||
@ -132,11 +135,16 @@ 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/' +
|
||||
str(data['id']) + '@600-' +
|
||||
data['url'].split('/')[-2].split('.')[0] + '.jpg')
|
||||
|
||||
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…
Reference in New Issue
Block a user