[fanbox] skip 404ed fanbox embeds (#4088)

continuation of 4fc9675d
pull/4159/head
Mike Fährmann 1 year ago
parent 54cf1fa3e7
commit 0281cc7d08
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -214,9 +214,15 @@ class FanboxExtractor(Extractor):
# to a proper Fanbox URL
url = "https://www.pixiv.net/fanbox/"+content_id
# resolve redirect
response = self.request(url, method="HEAD", allow_redirects=False)
url = response.headers["Location"]
final_post["_extractor"] = FanboxPostExtractor
try:
url = self.request(url, method="HEAD",
allow_redirects=False).headers["location"]
except Exception as exc:
url = None
self.log.warning("Unable to extract fanbox embed %s (%s: %s)",
content_id, exc.__class__.__name__, exc)
else:
final_post["_extractor"] = FanboxPostExtractor
elif provider == "twitter":
url = "https://twitter.com/_/status/"+content_id
elif provider == "google_forms":

Loading…
Cancel
Save