mardi 20 octobre 2020

Web Scraping: How to get the class

I want to get information of the class when I run the program The output comes up as "None"

import requests
import bs4
import lxml

res =requests.get('https://www.reddit.com/r/Python/')

soup = bs4.BeautifulSoup(res.text,'lxml')
link = 'https://www.reddit.com/r/Python/'

div = soup.find('div', {"_1lwNBHmCQJObvqs1fXKSYR" : link}) #This is the class of the New title kinda thing
text = div
print(text)

The output I get is

None

What should I do? Thanks for the help!

Aucun commentaire:

Enregistrer un commentaire