Skip to content

Commit

Permalink
[booru] improve error handling
Browse files Browse the repository at this point in the history
e.g. for posts without a valid 'file_url' (#1176)
  • Loading branch information
mikf committed Dec 17, 2020
1 parent 1f9121f commit 8d2e4e5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## Unreleased

## 1.16.0 - 2020-12-12
### Additions
- [booru] implement generalized extractors for `*booru` and `moebooru` sites
Expand Down
6 changes: 5 additions & 1 deletion gallery_dl/extractor/booru.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def items(self):
for post in self.posts():
try:
url = self._prepare_post(post, extended_tags)
except KeyError:
if url[0] == "/":
url = self.root + url
except Exception:
self.log.debug("Unable to fetch download URL for post %s "
"(md5: %s)", post.get("id"), post.get("md5"))
continue
post.update(data)
text.nameext_from_url(url, post)
Expand Down
2 changes: 0 additions & 2 deletions gallery_dl/extractor/moebooru.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class MoebooruExtractor(BooruExtractor):

def _prepare_post(self, post, extended_tags=False):
url = post["file_url"]
if url[0] == "/":
url = self.root + url
if extended_tags:
self._fetch_extended_tags(post)
post["date"] = text.parse_timestamp(post["created_at"])
Expand Down
2 changes: 0 additions & 2 deletions gallery_dl/extractor/sankaku.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class SankakuExtractor(BooruExtractor):

def _prepare_post(self, post, extended_tags=False):
url = post["file_url"]
if url[0] == "/":
url = self.root + url
if extended_tags:
self._fetch_extended_tags(post)
post["date"] = text.parse_timestamp(post["created_at"]["s"])
Expand Down
2 changes: 1 addition & 1 deletion gallery_dl/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

__version__ = "1.16.0"
__version__ = "1.16.1-dev"

0 comments on commit 8d2e4e5

Please sign in to comment.