[booru] improve error handling
e.g. for posts without a valid 'file_url' (#1176)
This commit is contained in:
parent
1f9121fecb
commit
8d2e4e5f13
@ -1,5 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 1.16.0 - 2020-12-12
|
||||
### Additions
|
||||
- [booru] implement generalized extractors for `*booru` and `moebooru` sites
|
||||
|
@ -30,7 +30,11 @@ class BooruExtractor(Extractor):
|
||||
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)
|
||||
|
@ -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"])
|
||||
|
@ -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"])
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user