mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-09 09:35:33 +00:00
@@ -13,11 +13,14 @@ def css_filter(css_filter, html_content):
|
|||||||
|
|
||||||
# Extract/find element
|
# Extract/find element
|
||||||
def extract_element(find='title', html_content=''):
|
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')
|
soup = BeautifulSoup(html_content, 'html.parser')
|
||||||
title = soup.find(find)
|
result = soup.find(find)
|
||||||
if title and title.string is not None:
|
if result and result.string:
|
||||||
html_title = title.string.strip()
|
element_text = result.string.strip()
|
||||||
|
|
||||||
|
return element_text
|
||||||
|
|
||||||
return html_title
|
|
||||||
|
|||||||
@@ -185,6 +185,10 @@ class ChangeDetectionStore:
|
|||||||
self.__data['watching'][uuid]['viewed'] = False
|
self.__data['watching'][uuid]['viewed'] = False
|
||||||
has_unviewed = True
|
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
|
self.__data['has_unviewed'] = has_unviewed
|
||||||
|
|
||||||
return self.__data
|
return self.__data
|
||||||
|
|||||||
Reference in New Issue
Block a user