fix problem in download.py when title has not been set
This commit is contained in:
@@ -43,9 +43,14 @@ if __name__ == '__main__':
|
||||
for item in data:
|
||||
link = item['url']
|
||||
log.info(f"{item['id']} - {str(link)}")
|
||||
if not link:
|
||||
continue
|
||||
try:
|
||||
r = requests.get(link)
|
||||
soup = BeautifulSoup(r.content, "html.parser")
|
||||
title_tag = soup.find('title')
|
||||
if title_tag:
|
||||
title= title_tag.get_text()
|
||||
title = soup.title.string
|
||||
item['title'] = title
|
||||
item['review'] = False
|
||||
|
||||
Reference in New Issue
Block a user