mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 08:39:59 -05:00
Disable screenshot on 4xx/5xx when simpler404 option is used
Also update the relevant comment.
This commit is contained in:
parent
dc0f2a7455
commit
7ad7a230f6
@ -503,9 +503,8 @@ class Browser:
|
|||||||
page_url)
|
page_url)
|
||||||
self.navigate_to_page(page_url, timeout=page_timeout)
|
self.navigate_to_page(page_url, timeout=page_timeout)
|
||||||
# If the target page HTTP status is 4xx/5xx, there is no point
|
# If the target page HTTP status is 4xx/5xx, there is no point
|
||||||
# in running behaviors, outlink and hashtag extraction as we
|
# in running behaviors, screenshot, outlink and hashtag
|
||||||
# didn't get a valid page. Screenshot should run because i
|
# extraction as we didn't get a valid page.
|
||||||
# may be useful to have a picture of the error page.
|
|
||||||
# This is only enabled with option `simpler404`.
|
# This is only enabled with option `simpler404`.
|
||||||
run_behaviors = True
|
run_behaviors = True
|
||||||
if simpler404 and (self.websock_thread.page_status is None or
|
if simpler404 and (self.websock_thread.page_status is None or
|
||||||
@ -518,9 +517,14 @@ class Browser:
|
|||||||
behaviors_dir=behaviors_dir)
|
behaviors_dir=behaviors_dir)
|
||||||
self.run_behavior(behavior_script, timeout=behavior_timeout)
|
self.run_behavior(behavior_script, timeout=behavior_timeout)
|
||||||
final_page_url = self.url()
|
final_page_url = self.url()
|
||||||
if on_screenshot and self.websock_thread.page_status and \
|
if on_screenshot:
|
||||||
self.websock_thread.page_status < 400:
|
if simpler404:
|
||||||
self._try_screenshot(on_screenshot, screenshot_full_page)
|
if self.websock_thread.page_status and \
|
||||||
|
self.websock_thread.page_status < 400:
|
||||||
|
self._try_screenshot(on_screenshot, screenshot_full_page)
|
||||||
|
else:
|
||||||
|
self._try_screenshot(on_screenshot, screenshot_full_page)
|
||||||
|
|
||||||
if not run_behaviors or skip_extract_outlinks:
|
if not run_behaviors or skip_extract_outlinks:
|
||||||
outlinks = []
|
outlinks = []
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user