Re #106 - handling empty title with gettr cleanup (#107)

pull/115/head
dgtlmoon 3 years ago committed by GitHub
parent 3fa6bc5ffd
commit db18866b0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save