url preview: Return generic parser <p> text as str (not bs4 string).

This commit is contained in:
Puneeth Chaganti
2019-05-05 23:45:00 +05:30
committed by Tim Abbott
parent 2b3de816a8
commit d02eb99831

View File

@@ -25,11 +25,11 @@ class GenericParser(BaseParser):
first_h1 = soup.find('h1')
if first_h1:
first_p = first_h1.find_next('p')
if (first_p and first_p.string != ''):
if (first_p and first_p.text != ''):
return first_p.text
first_p = soup.find('p')
if (first_p and first_p.string != ''):
return first_p.string
if (first_p and first_p.text != ''):
return first_p.text
return None
def _get_image(self) -> Optional[str]: