Reputation: 2455
I am trying to search a query in yahoo using this code:
import re
import requests
query = "deep"
yahoo = "https://search.yahoo.com/search?q=" + query
raw_page = requests.get(yahoo)
But I get an error like this:
TypeError: init() got an unexpected keyword argument 'strict'
The error happens at the last line. How can I fix this?
This is the whole code:
import re
import requests
no = 10
query = "deep"
yahoo = "https://search.yahoo.com/search?q=" + query + "&n=" + str(no)
#yahoo = "https://search.yahoo.com/search?p=" + query
raw_page = requests.get(yahoo)
results = re.findall(r'(?<=<h3 class="r"><a href="/url\?q=).*?(?=&)', str(raw_page))
res = list(set(results))[0:30] #Provides 30 unique of the 35 we requested above
print(res)
and this is the error track:
Upvotes: 0
Views: 71