Automating Search Interest & Trends Data Access with Python
Google Colab notebook for automating download of Trends search interest data, inspired from this Search Engine Land writeup. Special thanks to Fozan for his help with populating the CSV download portion. 🙂
pip install pytrends
import pytrends
from pytrends.request import TrendReq
import pandas as pd # Sets up the Pandas data analysis library
import time
import datetime
from datetime import datetime, date, time
from google.colab import drive
from google.colab import files
pytrend = TrendReq()
pytrend.build_payload(kw_list=['digital marketing', 'digital media', 'interactive marketing', 'digital advertising'], timeframe='today 5-y', geo='US')
data = pytrend.interest_over_time()
df = pd.DataFrame(data)
df.to_csv('pytrends_data.csv', encoding='utf-8-sig')
files.download('pytrends_data.csv')
Google Colab notebook for automating download of Trends search interest data, inspired from this Search Engine Land writeup. Special thanks to Fozan for his help with populating the CSV download portion. 🙂