Beautiful Soup


import requests, bs4

res = requests.get('http://web-profile.net/readme.html')

try:

    res.raise_for_status()

except Exception as exc:

    print('There was a problem: %s' % (exc))

bsObj = bs4.BeautifulSoup(res.text, 'lxml')

print(type(bsObj)) # <class 'bs4.BeautifulSoup'>

Run this code into command line to install Beautiful Soap:

pip install beautifulsoup4

Run this code into command line to install lxml html-parser:

pip install lxml

Leave a Comment