Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [crawler] error catcher #487

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/torcrawler/TorSplashCrawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def start_requests(self):
self.parse,
errback=self.errback_catcher,
endpoint='execute',
meta={'father': self.original_item},
meta={'father': self.original_item, 'current_url': self.start_urls},
args=l_cookies
)

Expand Down Expand Up @@ -217,7 +217,7 @@ def parse(self,response):
self.parse,
errback=self.errback_catcher,
endpoint='execute',
meta={'father': item_id},
meta={'father': item_id, 'current_url': link.url},
args=l_cookies
)

Expand All @@ -227,7 +227,7 @@ def errback_catcher(self, failure):

if failure.check(ResponseNeverReceived):
request = failure.request
url= response.data['last_url']
url= request.meta['current_url']
father = request.meta['father']

self.logger.error('Splash, ResponseNeverReceived for %s, retry in 10s ...', url)
Expand All @@ -242,7 +242,7 @@ def errback_catcher(self, failure):
errback=self.errback_catcher,
endpoint='execute',
cache_args=['lua_source'],
meta={'father': father},
meta={'father': father, 'current_url': url},
args=self.build_request_arg(response.cookiejar)
)

Expand Down