Some changes werent getting triggered because the previous checksum only recorded when an event occured
This commit is contained in:
@@ -224,11 +224,7 @@ class perform_site_check():
|
|||||||
else:
|
else:
|
||||||
fetched_md5 = hashlib.md5(stripped_text_from_html).hexdigest()
|
fetched_md5 = hashlib.md5(stripped_text_from_html).hexdigest()
|
||||||
|
|
||||||
# On the first run of a site, watch['previous_md5'] will be None, set it the current one.
|
############ Blocking rules, after checksum #################
|
||||||
if not watch.get('previous_md5'):
|
|
||||||
watch['previous_md5'] = fetched_md5
|
|
||||||
update_obj["previous_md5"] = fetched_md5
|
|
||||||
|
|
||||||
blocked_by_not_found_trigger_text = False
|
blocked_by_not_found_trigger_text = False
|
||||||
|
|
||||||
if len(watch['trigger_text']):
|
if len(watch['trigger_text']):
|
||||||
@@ -245,7 +241,7 @@ class perform_site_check():
|
|||||||
|
|
||||||
if not blocked_by_not_found_trigger_text and watch['previous_md5'] != fetched_md5:
|
if not blocked_by_not_found_trigger_text and watch['previous_md5'] != fetched_md5:
|
||||||
changed_detected = True
|
changed_detected = True
|
||||||
update_obj["previous_md5"] = fetched_md5
|
|
||||||
update_obj["last_changed"] = timestamp
|
update_obj["last_changed"] = timestamp
|
||||||
|
|
||||||
# Extract title as title
|
# Extract title as title
|
||||||
@@ -254,4 +250,12 @@ class perform_site_check():
|
|||||||
if not watch['title'] or not len(watch['title']):
|
if not watch['title'] or not len(watch['title']):
|
||||||
update_obj['title'] = html_tools.extract_element(find='title', html_content=fetcher.content)
|
update_obj['title'] = html_tools.extract_element(find='title', html_content=fetcher.content)
|
||||||
|
|
||||||
|
# Always record the new checksum
|
||||||
|
update_obj["previous_md5"] = fetched_md5
|
||||||
|
|
||||||
|
# On the first run of a site, watch['previous_md5'] will be None, set it the current one.
|
||||||
|
if not watch.get('previous_md5'):
|
||||||
|
watch['previous_md5'] = fetched_md5
|
||||||
|
|
||||||
|
|
||||||
return changed_detected, update_obj, text_content_before_ignored_filter, fetcher.screenshot, fetcher.xpath_data
|
return changed_detected, update_obj, text_content_before_ignored_filter, fetcher.screenshot, fetcher.xpath_data
|
||||||
|
|||||||
Reference in New Issue
Block a user