6

I try to use soup4 with my python3.5 ,but evrey time i rule a code to extrac something from internet i get this error :

 - s4\__init__.py", line 198, in __init__
       % ",".join(features)) bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to    install a parser library?

There was a link with the same error in this site bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library? I tried all , still get the error

All the pip install requests pip install lxml pip install beautifull soup4

I download soup4 https://www.crummy.com/software/BeautifulSoup/bs4/download/4.6/ manual an install it setup.py install

I have all updated and working , but still i get the error plz help me

user10451243
  • 79
  • 1
  • 1
  • 5

4 Answers4

16

If you are using html5lib as an underlying parser:

soup = BeautifulSoup(html, "html5lib")
#                            ^HERE^

Then, you need to have html5lib module installed in your python environment:

pip install html5lib

Documentation reference: Installing a parser.

alecxe
  • 441,113
  • 110
  • 1,021
  • 1,148
2

For those that get the same error even with html5lib installed, replace "html5lib" for "html.parser" as suggested in https://github.com/coursera-dl/edx-dl/issues/434

Worked for me :)

dduque
  • 308
  • 3
  • 14
0

For me html.parser work

from bs4 import BeautifulSoup
import urllib.request 
response = urllib.request.urlopen('http://php.net/') 
html = response.read()
soup = BeautifulSoup(html,"html.parser")
text = soup.get_text(strip=True)
print (text)
Vijay
  • 101
  • 7
0

Use 'html.parser' instead of 'html5lib'. This will work.

Mike Brian Olivera
  • 1,245
  • 1
  • 15
  • 21