Skip to content

Commit

Permalink
prevent infinite recursion when spawning extractors (closes #489)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Dec 26, 2019
1 parent 896896a commit 2e2fc7f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gallery_dl/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def __init__(self, url, parent=None):
self.downloaders = {}
self.postprocessors = None
self.out = output.select()
self.visited = parent.visited if parent else set()

def handle_url(self, url, kwdict, fallback=None):
"""Download the resource specified in 'url'"""
Expand Down Expand Up @@ -261,6 +262,10 @@ def handle_metadata(self, kwdict):
pp.run_metadata(pathfmt)

def handle_queue(self, url, kwdict):
if url in self.visited:
return
self.visited.add(url)

if "_extractor" in kwdict:
extr = kwdict["_extractor"].from_url(url)
else:
Expand Down

0 comments on commit 2e2fc7f

Please sign in to comment.