爬蟲報錯:Do you need to install a parser library?
環(huán)境是windows8下的pycharm,爬的百度也有https
因為爬失敗所以去掉了spider_main.py中的try,expect
發(fā)現(xiàn)返回報錯:
craw 1 : https://baike.baidu.com/item/Python/407313?fr=aladdin
Traceback (most recent call last):
? File "S:/baike_spider/spider_main.py", line 43, in <module>
? ? obj_spider.craw(root_url)? # 啟動爬蟲
? File "S:/baike_spider/spider_main.py", line 27, in craw
? ? new_urls, new_data = self.parser.parse(new_url, html_cont)? # 新的列表
? File "S:\baike_spider\html_parser.py", line 39, in parse
? ? soup = BeautifulSoup(html_cont, 'html_parser', from_encoding='utf-8')
? File "E:\Tools\Python\Python3.5\lib\site-packages\bs4\__init__.py", line 165, in __init__
? ? % ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html_parser. Do you need to install a parser library?
好像是解析器的問題,求解謝謝
2018-01-15
將html_parser 改成 html.parser試試,我的能運行成功了
2018-04-28
2018-02-03
太棒了,感謝樓上,成功了!