fix summary scraping problem of douban movies

This commit is contained in:
doubaniux 2020-11-16 13:36:31 +01:00
parent 0fb7cd8956
commit c2b3a5ff66

View file

@ -358,7 +358,7 @@ def scrape_douban_movie(url):
brief_elem = content.xpath("//span[@class='all hidden']")
if not brief_elem:
brief_elem = content.xpath("//span[@property='v:summary']")
brief = brief_elem[0].xpath('./text()')[0].strip() if brief_elem else None
brief = '\n'.join([e.strip() for e in brief_elem[0].xpath('./text()')]) if brief_elem else None
img_url_elem = content.xpath("//img[@rel='v:image']/@src")
img_url = img_url_elem[0].strip() if img_url_elem else None