Use this project to search Google Trends website for downloading the frequency or usage of keywords (search terms) that are of your interest (max 5 at a time).
Even though pytrends
package can do similar tasks, my problem is something different and therefore I quickly built this project to solve it. Please modify the code as per your need.
- The resolution of trends searched will be at city level
- The Include low search volume regions checkbox will be selected by default
- If you don't want the driver browser in action, then in the file
src/scrape_gtrends.py
uncomment the line: # options.add_argument('--headless')
In the main.py
file, under the section User Inputs, modify the values as per your need and save it.
# At least 1 and max of 5 keywords
keywords = ["bitcoin", "ethereum", "tether", "solana", "dogecoin"]
start_date = "2024-04-09"
end_date = "2024-05-09"
# For list of country names and their geocodes, check the file "utils/country_geo_codes.csv"
geo = "GB"
# Change this to actual path on your system to folder "Data_Output"
# Adjust the path format style based on the OS you are using (Linux, Windows, Mac)
csv_directory_location = '/home/xxxxx/xxxxx/GoogleTrends/Data_Output'
Open your terminal, run the following lines:
$ cd GoogleTrends
# It is highly recommended to create a virtual environment and install the following libraries
$ pip3 install -r requirements.txt
# Run the script
$ python3 main,py
In the above example:
- the following csv files will be downloaded from Google Trends website to the folder
Data_Output
File | Notes | |
---|---|---|
1 | Data_Output/kwds_score_relative_each_other.csv | Compared breakdown by city |
2 | Data_Output/scores_for_kwd_bitcoin.csv | Interest by city for the word bitcoin |
3 | Data_Output/scores_for_kwd_ethereum.csv | Interest by city for the word ethereum |
4 | Data_Output/scores_for_kwd_tether.csv | Interest by city for the word tether |
5 | Data_Output/scores_for_kwd_solana.csv | Interest by city for the word solana |
6 | Data_Output/scores_for_kwd_dogecoin.csv | Interest by city for the word dogecoin |
- the files (above) will be parsed/cleaned and saved as two addition files
File | Notes | |
---|---|---|
7 | Data_Output/cleaned_kwds_score_relative_each_other.csv | Compared breakdown by city (cleaned) |
8 | Data_Output/scores_for_kwds_combined.csv | Interest by city for each key word (cleaned and merged) |