Skip to content

Commit

Permalink
[fuskator] make metadata extraction non-fatal (#5039)
Browse files Browse the repository at this point in the history
- prevent KeyErrors
- prevent HTTP redirect
- return file URLs as list
  • Loading branch information
mikf committed Jan 8, 2024
1 parent 657ed93 commit ec958a2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions gallery_dl/extractor/fuskator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FuskatorGalleryExtractor(GalleryExtractor):

def __init__(self, match):
self.gallery_hash = match.group(1)
url = "{}/thumbs/{}/".format(self.root, self.gallery_hash)
url = "{}/thumbs/{}/index.html".format(self.root, self.gallery_hash)
GalleryExtractor.__init__(self, match, url)

def metadata(self, page):
Expand Down Expand Up @@ -50,15 +50,16 @@ def metadata(self, page):
"gallery_id" : text.parse_int(gallery_id),
"gallery_hash": self.gallery_hash,
"title" : text.unescape(title[:-15]),
"views" : data["hits"],
"score" : data["rating"],
"tags" : data["tags"].split(","),
"count" : len(data["images"]),
"views" : data.get("hits"),
"score" : data.get("rating"),
"tags" : (data.get("tags") or "").split(","),
}

def images(self, page):
for image in self.data["images"]:
yield "https:" + image["imageUrl"], image
return [
("https:" + image["imageUrl"], image)
for image in self.data["images"]
]


class FuskatorSearchExtractor(Extractor):
Expand Down

0 comments on commit ec958a2

Please sign in to comment.