douban_crawler icon indicating copy to clipboard operation
douban_crawler copied to clipboard

列表中存在已被豆瓣移除条目会导致错误,无法读取

Open qilinz opened this issue 3 years ago • 0 comments

Hi! 感谢脚本,很方便。 遇到一个问题就是,如果列表中存在已被移除的条目会发生错误,导致程序无法运行。

手动解决办法就是在豆瓣上删除不存在的条目。

报错如下: Traceback (most recent call last): File "personalCrawler.py", line 8, in <module> bookv2.main() File "/Users/xxx/Documents/douban_crawler-master/code/bookv2.py", line 260, in main clawer.main() File "/Users/xxx/Documents/douban_crawler-master/code/bookv2.py", line 239, in main self.Saw() File "/Users/xxx/Documents/douban_crawler-master/code/bookv2.py", line 183, in Saw if (self.saw_store(soup.find_all(class_='item'),lastBid) == -1): File "/Users/xxx/Documents/douban_crawler-master/code/bookv2.py", line 139, in saw_store date,star,comment,owntag,name,bid=self.saw_get(item) File "/Users/xxx/Documents/douban_crawler-master/code/bookv2.py", line 147, in saw_get date=saw(class_=re.compile('date'))[0].get_text(strip=True) IndexError: list index out of range

qilinz avatar Oct 21 '21 10:10 qilinz