google_scraper is a command-line utiility that automates the process of scraping google search results and associated metadata. Results are output into an xlsx file in the directory from which the script is run in reverse chronological order.
Data scraped by google_scraper includes urls, titles, content snippets, and date published. It will additionally detect the language of a result, extract the domain from a url, and output the date the scrape was conducted.
To install google_scraper directly into the site-packages directory of your virtual environment, run:
pip install git+https://github.com/agile-enigma/google_scraper.git
urlFormatter can now be used a command-line utility from anywhere in your directory structure or accessed
as a module via import google_scraper
.
The command-line arguments taken by google_scraper are as follows:
- -s/--start_date: The earliest date for which search results are desired (format: mm/dd/yyyy)
- -s/--end_date : The latest date for which search results are desired (format: mm/dd/yyyy)
- -q/--query : Google search string. If it contains multiple terms/operators, enclose it in single quotes
Here is an example query:
python3 -m google_scraper -s 05/01/2024 -e 05/10/2024 -q '"Georgia" AND "protests" AND "foreign agents law"'
![Screenshot 2024-05-13 at 11 05 59 PM](https://private-user-images.githubusercontent.com/110642777/330264169-364a3894-1ecc-42a9-9adf-2d3f839ed941.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2MzExMzcsIm5iZiI6MTcyNTYzMDgzNywicGF0aCI6Ii8xMTA2NDI3NzcvMzMwMjY0MTY5LTM2NGEzODk0LTFlY2MtNDJhOS05YWRmLTJkM2Y4MzllZDk0MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwNlQxMzUzNTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mMmJjNDJjYjg5MDI2ZGRmMTM2YjQ5ZDg2ZGQ2ZGI4YTNiYTViNDgzZWI4NDNhOTY4MzNkMDFhOWE2YzRkNzk5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.6qa5N1BclwB5Rf4yrgmh6OUedxHuodxZijSczn7QvJ8)