reuse connection adapters from parent extractors
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2015-2019 Mike Fährmann
|
||||
# Copyright 2015-2020 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
@@ -28,6 +28,7 @@ class RecursiveExtractor(Extractor):
|
||||
|
||||
self.session.mount("file://", FileAdapter())
|
||||
page = self.request(self.url.partition(":")[2]).text
|
||||
del self.session.adapters["file://"]
|
||||
|
||||
yield Message.Version, 1
|
||||
with extractor.blacklist(blist):
|
||||
|
||||
@@ -34,10 +34,16 @@ class Job():
|
||||
self.pred_url = self._prepare_predicates("image", True)
|
||||
self.pred_queue = self._prepare_predicates("chapter", False)
|
||||
|
||||
if parent and parent.extractor.config(
|
||||
"category-transfer", parent.extractor.categorytransfer):
|
||||
self.extractor.category = parent.extractor.category
|
||||
self.extractor.subcategory = parent.extractor.subcategory
|
||||
if parent:
|
||||
pextr = parent.extractor
|
||||
|
||||
# transfer (sub)category
|
||||
if pextr.config("category-transfer", pextr.categorytransfer):
|
||||
extr.category = pextr.category
|
||||
extr.subcategory = pextr.subcategory
|
||||
|
||||
# reuse connection adapters
|
||||
extr.session.adapters = pextr.session.adapters
|
||||
|
||||
# user-supplied metadata
|
||||
self.userkwds = self.extractor.config("keywords")
|
||||
|
||||
Reference in New Issue
Block a user