diff --git a/changedetectionio/content_fetcher.py b/changedetectionio/content_fetcher.py
index 15416f724..dab956a5a 100644
--- a/changedetectionio/content_fetcher.py
+++ b/changedetectionio/content_fetcher.py
@@ -77,12 +77,13 @@ class ScreenshotUnavailable(Exception):
class ReplyWithContentButNoText(Exception):
- def __init__(self, status_code, url, screenshot=None, has_filters=False):
+ def __init__(self, status_code, url, screenshot=None, has_filters=False, html_content=''):
# Set this so we can use it in other parts of the app
self.status_code = status_code
self.url = url
self.screenshot = screenshot
self.has_filters = has_filters
+ self.html_content = html_content
return
diff --git a/changedetectionio/processors/text_json_diff.py b/changedetectionio/processors/text_json_diff.py
index 702a8ce21..5e69a5916 100644
--- a/changedetectionio/processors/text_json_diff.py
+++ b/changedetectionio/processors/text_json_diff.py
@@ -317,7 +317,8 @@ class perform_site_check(difference_detection_processor):
raise content_fetcher.ReplyWithContentButNoText(url=url,
status_code=fetcher.get_last_status_code(),
screenshot=screenshot,
- has_filters=has_filter_rule and len(html_content)
+ has_filters=has_filter_rule,
+ html_content=html_content
)
# We rely on the actual text in the html output.. many sites have random script vars etc,
diff --git a/changedetectionio/update_worker.py b/changedetectionio/update_worker.py
index 11ad50548..ecffd39f2 100644
--- a/changedetectionio/update_worker.py
+++ b/changedetectionio/update_worker.py
@@ -3,7 +3,7 @@ import threading
import queue
import time
-from changedetectionio import content_fetcher
+from changedetectionio import content_fetcher, html_tools
from .processors.text_json_diff import FilterNotFoundInResponse
from .processors.restock_diff import UnableToExtractRestockData
@@ -251,10 +251,19 @@ class update_worker(threading.Thread):
# Totally fine, it's by choice - just continue on, nothing more to care about
# Page had elements/content but no renderable text
# Backend (not filters) gave zero output
+ extra_help = ""
if e.has_filters:
- self.datastore.update_watch(uuid=uuid, update_obj={'last_error': f"Got HTML content but no text found (With {e.status_code} reply code), it's possible that the filters you have give an empty result or contain only an image more help here"})
- else:
- self.datastore.update_watch(uuid=uuid, update_obj={'last_error': f"Got HTML content but no text found (With {e.status_code} reply code)."})
+ # Maybe it contains an image? offer a more helpful link
+ has_img = html_tools.include_filters(include_filters='img',
+ html_content=e.html_content)
+ if has_img:
+ extra_help = ", it's possible that the filters you have give an empty result or contain only an image more help here"
+ else:
+ extra_help = ", it's possible that the filters were found, but contained no usable text"
+
+ self.datastore.update_watch(uuid=uuid, update_obj={
+ 'last_error': f"Got HTML content but no text found (With {e.status_code} reply code){extra_help}"
+ })
if e.screenshot:
self.datastore.save_screenshot(watch_uuid=uuid, screenshot=e.screenshot)