I've been experimenting with the requests and the bs4 module for a couple of days now. I wanted to make a simple program similar to the 'I'm Feeling Lucky' from google.
Here's my code:
import requests, bs4, webbrowser source=requests.get('https://www.google.com/search?q=facebook').text exsoup=bs4.BeautifulSoup(source, 'lxml') # <cite class="iUh30">https://www.facebook.com/</cite> match=exsoup.find('cite', class_='iUh30') print(match.text)
But when I run this I get the following error:
print(match.text) AttributeError: 'NoneType' object has no attribute 'text'
How can I make this work?