mercredi 3 juillet 2019

How do I collect elements with Beautiful Soup?

I'm trying to make a web scraper with beautiful soup but every time I try scrape the website I dont get anything back. In the following code I use requests to fetch the website then I put it into the beautiful soup object. After that I try to scrape for all the tags.

Ive tried watching youtube tutorials and looked at the documentation for the framework but i just dont understand how to use it.

from bs4 import BeautifulSoup
import bs4
import urllib

url = requests.get("https://www.rt.com/")

print(url.status_code)

soup = BeautifulSoup(url.content, 'html.parser')

soup.find_all('div')




Aucun commentaire:

Enregistrer un commentaire