mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
fix issues with 'Extractor.finalize()'
- prevent crash in InstagramUserExtractor (#4359) - call it at the end of every DownloadJob - add it to tests
This commit is contained in:
parent
ed21908fda
commit
48ef062867
@ -36,7 +36,6 @@ class Extractor():
|
||||
browser = None
|
||||
root = ""
|
||||
test = None
|
||||
finalize = None
|
||||
request_interval = 0.0
|
||||
request_interval_min = 0.0
|
||||
request_timestamp = 0.0
|
||||
@ -66,6 +65,9 @@ class Extractor():
|
||||
self._init()
|
||||
self.initialize = util.noop
|
||||
|
||||
def finalize(self):
|
||||
pass
|
||||
|
||||
def items(self):
|
||||
yield Message.Version, 1
|
||||
|
||||
|
@ -405,6 +405,9 @@ class InstagramUserExtractor(InstagramExtractor):
|
||||
def initialize(self):
|
||||
pass
|
||||
|
||||
def finalize(self):
|
||||
pass
|
||||
|
||||
def items(self):
|
||||
base = "{}/{}/".format(self.root, self.item)
|
||||
stories = "{}/stories/{}/".format(self.root, self.item)
|
||||
|
@ -140,8 +140,7 @@ class Job():
|
||||
log.info("No results for %s", extractor.url)
|
||||
finally:
|
||||
self.handle_finalize()
|
||||
if extractor.finalize:
|
||||
extractor.finalize()
|
||||
extractor.finalize()
|
||||
|
||||
return self.status
|
||||
|
||||
|
@ -138,6 +138,7 @@ class TestExtractorModule(unittest.TestCase):
|
||||
for test in cls._get_tests():
|
||||
extr = cls.from_url(test[0])
|
||||
extr.initialize()
|
||||
extr.finalize()
|
||||
break
|
||||
|
||||
def test_docstrings(self):
|
||||
|
Loading…
Reference in New Issue
Block a user