[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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user