Skip to content

Commit

Permalink
[wikimedia] suppress exception for entries without 'imageinfo' (mikf#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Mar 26, 2024
1 parent 9cce461 commit ef0c904
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gallery_dl/extractor/wikimedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def _init(self):

def items(self):
for info in self._pagination(self.params):
image = info["imageinfo"][0]
try:
image = info["imageinfo"][0]
except LookupError:
self.log.debug("Missing 'imageinfo' for %s", info)
continue

image["metadata"] = {
m["name"]: m["value"]
Expand Down
8 changes: 8 additions & 0 deletions test/results/azurlanewiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@
"#class" : wikimedia.WikimediaArticleExtractor,
},

{
"#url" : "https://azurlane.koumakan.jp/wiki/Louisville/Gallery",
"#comment" : "entries with missing 'imageinfo' (#5384)",
"#category": ("wikimedia", "azurlanewiki", "article"),
"#class" : wikimedia.WikimediaArticleExtractor,
"#count" : "> 10",
},

)

0 comments on commit ef0c904

Please sign in to comment.