mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-07 16:45:33 +00:00
@@ -13,11 +13,14 @@ def css_filter(css_filter, html_content):
|
||||
|
||||
# Extract/find element
|
||||
def extract_element(find='title', html_content=''):
|
||||
html_title = False
|
||||
|
||||
#Re #106, be sure to handle when its not found
|
||||
element_text = None
|
||||
|
||||
soup = BeautifulSoup(html_content, 'html.parser')
|
||||
title = soup.find(find)
|
||||
if title and title.string is not None:
|
||||
html_title = title.string.strip()
|
||||
result = soup.find(find)
|
||||
if result and result.string:
|
||||
element_text = result.string.strip()
|
||||
|
||||
return element_text
|
||||
|
||||
return html_title
|
||||
|
||||
@@ -185,6 +185,10 @@ class ChangeDetectionStore:
|
||||
self.__data['watching'][uuid]['viewed'] = False
|
||||
has_unviewed = True
|
||||
|
||||
# #106 - Be sure this is None on empty string, False, None, etc
|
||||
if not self.__data['watching'][uuid]['title']:
|
||||
self.__data['watching'][uuid]['title'] = None
|
||||
|
||||
self.__data['has_unviewed'] = has_unviewed
|
||||
|
||||
return self.__data
|
||||
|
||||
Reference in New Issue
Block a user