provide type information for Queue messages

Child extractors are now directly constructed with Extractor.from_url()
if the extractor class is known beforehand, instead of using
extractor.find() and searching through all possible extractor classes.
This commit is contained in:
Mike Fährmann
2019-02-12 21:26:41 +01:00
parent 2e516a1e3e
commit 61741d7333
16 changed files with 53 additions and 25 deletions

View File

@@ -99,7 +99,7 @@ class XvideosUserExtractor(XvideosExtractor):
test = (
("https://www.xvideos.com/profiles/pervertedcouple", {
"url": "a413f3e60d6d3a2de79bd44fa3b7a9c03db4336e",
"keyword": "a796760d34732adc7ec52a8feb057515209a2ca6",
"keyword": "ef941489354fd8f4754c8a87cffd5e2429a6387c",
}),
("https://www.xvideos.com/profiles/niwehrwhernvh", {
"exception": exception.NotFoundError,
@@ -123,9 +123,12 @@ class XvideosUserExtractor(XvideosExtractor):
del data["galleries"]["0"]
galleries = [
{"gallery_id": text.parse_int(gid),
"title": text.unescape(gdata["title"]),
"count": gdata["nb_pics"]}
{
"gallery_id": text.parse_int(gid),
"title": text.unescape(gdata["title"]),
"count": gdata["nb_pics"],
"_extractor": XvideosGalleryExtractor,
}
for gid, gdata in data["galleries"].items()
]
galleries.sort(key=lambda x: x["gallery_id"])