Answer the question
In order to leave comments, you need to log in
How to generate query link in google in python?
Let's say I want to request in Google: Dollar rate
If done manually, write "Dollar rate" in Google and copy the link, it looks like this: www.google.ru/search?q=Dollar+rate&oq=Dollar+rate&aqs=chrome.. 69i57j69i59j0l4.3083j0j1&sourceid=chrome&ie=UTF-8
How to generate the same link automatically in python? Not necessarily this particular request, I gave an example. What libraries are there for this?
Answer the question
In order to leave comments, you need to log in
The requests library already knows how to encode urls out of the box
import requests
r = requests.get('https://www.google.com/search', {'q': 'Курс доллара'})
A simple query on Google gives, for example, the following library:
https://python-googlesearch.readthedocs.io/en/latest/
Using it couldn't be easier:
# Get the first 20 hits for: "Breaking Code" WordPress blog
from googlesearch import search
for url in search('"Breaking Code" WordPress blog', stop=20):
print(url)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question