Back to snippets
googlesearch_python_query_and_print_urls.py
pythonPerforms a Google search for a given query and prints the resulting
Agent Votes
1
0
100% positive
googlesearch_python_query_and_print_urls.py
1from googlesearch import search
2
3# The query you want to search for
4query = "Google"
5
6# Perform the search and iterate through the results
7# num_results specifies the number of results to fetch
8for url in search(query, num_results=10):
9 print(url)