diff --git a/gallery_dl/extractor/furaffinity.py b/gallery_dl/extractor/furaffinity.py index 78cf9fc4..ba60e19f 100644 --- a/gallery_dl/extractor/furaffinity.py +++ b/gallery_dl/extractor/furaffinity.py @@ -60,8 +60,11 @@ class FuraffinityExtractor(Extractor): ) return None + pi = text.parse_int + rh = text.remove_html + data = text.nameext_from_url(path, { - "id" : text.parse_int(post_id), + "id" : pi(post_id), "title" : title, "artist": artist, "user" : self.user or artist, @@ -70,12 +73,34 @@ class FuraffinityExtractor(Extractor): tags = extr('class="tags-row">', '') if tags: + # new site layout data["tags"] = text.split_html(tags) - data["description"] = text.unescape(text.remove_html(extr( + data["description"] = text.unescape(rh(extr( 'class="section-body">', ''), "", "")) + data["views"] = pi(rh(extr('class="views">', ''))) + data["favorites"] = pi(rh(extr('class="favorites">', ''))) + data["comments"] = pi(rh(extr('class="comments">', ''))) + data["rating"] = rh(extr('class="rating">', '')) + data["fa_category"] = rh(extr('>Category', '')) + data["theme"] = rh(extr('>', '<')) + data["species"] = rh(extr('>Species', '')) + data["gender"] = rh(extr('>Gender', '')) + data["width"] = pi(extr("", "x")) + data["height"] = pi(extr("", "p")) else: + # old site layout + data["fa_category"] = extr("Category:", "<").strip() + data["theme"] = extr("Theme:", "<").strip() + data["species"] = extr("Species:", "<").strip() + data["gender"] = extr("Gender:", "<").strip() + data["favorites"] = pi(extr("Favorites:", "<")) + data["comments"] = pi(extr("Comments:", "<")) + data["views"] = pi(extr("Views:", "<")) + data["width"] = pi(extr("Resolution:", "x")) + data["height"] = pi(extr("", "<")) data["tags"] = text.split_html(extr( 'id="keywords">', ''))[::2] + data["rating"] = extr('', ' ')
             data[", ""), "", "")) data["date"] = text.parse_timestamp(data["filename"].partition(".")[0]) @@ -162,6 +187,16 @@ class FuraffinityPostExtractor(FuraffinityExtractor): "title" : "Bude's 4 Ever", "url" : "re:https://d.facdn.net/art/mirlinthloth/music", "user" : "mirlinthloth", + "views" : int, + "favorites" : int, + "comments" : int, + "rating" : "General", + "fa_category": "Music", + "theme" : "All", + "species" : "Unspecified / Any", + "gender" : "Any", + "width" : 120, + "height" : 120, }, }), ("https://furaffinity.net/view/21835115/"),