improve 'extractor.request'

- add 'fatal' argument
- improve internal logic and flow
- raise known exception on error
- update exception hierarchy
This commit is contained in:
Mike Fährmann
2017-08-05 16:11:46 +02:00
parent dcd573806e
commit 915a0137de
12 changed files with 75 additions and 62 deletions

View File

@@ -65,7 +65,7 @@ class GfycatImageExtractor(GfycatExtractor):
def _get_info(self, gfycat_id):
url = "https://gfycat.com/cajax/get/" + gfycat_id
data = self.session.get(url).json()
data = self.request(url).json()
if "error" in data:
raise exception.NotFoundError()
raise exception.NotFoundError("animation")
return data["gfyItem"]