Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Simplified version of https://github.com/GeneralMills/pytrends: removed pandas dependency.
Unofficial API for Google Trends
Allows simple interface for automating downloading of reports from Google Trends. Main feature is to allow the script to login to Google on your behalf to enable a higher rate limit. Only good until Google changes their backend again :-P. When that happens feel free to contribute!
pip install simplifiedpytrends
from simplifiedpytrends.request import TrendReq
pytrends = TrendReq(hl='en-US', tz=360)
or if you want to use proxies as you are blocked due to Google rate limit:
from simplifiedpytrends.request import TrendReq
pytrends = TrendReq(hl='en-US', tz=360, proxies = {'https': 'https://34.203.233.13:80'})
Note: only https proxies will work, and you need to add the port number after the proxy ip address
kw_list = ["Blockchain"]
pytrends.build_payload(kw_list, cat=0, timeframe='today 5-y', geo='', gprop='')
Parameters
kw_list
The following API methods are available:
Many API methods use the following:
kw_list
keywords to get data for
Example ['Pizza']
Currently supports only one parameter
Advanced Keywords
"iron"
will have a drop down of "Iron Chemical Element, Iron Cross, Iron Man, etc"
.https://www.google.com/trends/explore#q=%2Fm%2F025rw19&cmpt=q
"%2Fm%2F025rw19"
is the topic "Iron Chemical Element" to use this with pytrendspytrends.suggestions()
to automate this.cat
cat=
and ends before the next &
or view this wiki page containing all available categories"https://www.google.com/trends/explore#q=pizza&cat=71"
'71'
is the categorygeo
'US'
'US-AL'
'GB-ENG'
tz
'360'
timeframe
Date to start from
Defaults to last 5yrs, 'today 5-y'
.
Everything 'all'
Specific dates, 'YYYY-MM-DD YYYY-MM-DD' example '2016-12-14 2017-01-25'
Specific datetimes, 'YYYY-MM-DDTHH YYYY-MM-DDTHH' example '2017-02-06T10 2017-02-12T07'
Current Time Minus Time Pattern:
By Month: 'today #-m'
where # is the number of months from that date to pull data for
'today 3-m'
would get data from today to 3months agoDaily: 'now #-d'
where # is the number of days from that date to pull data for
'now 7-d'
would get data from the last weekHourly: 'now #-H'
where # is the number of hours from that date to pull data for
'now 1-H'
would get data from the last hourgprop
'images'
images
, news
, youtube
or froogle
(for Google Shopping results)pytrends.interest_over_time()
Returns a sorted list of dict: containing "timestamp" and "data"
Original pytrends lib:
Major JSON revision ideas taken from pat310's JavaScript library
Connecting to google code heavily based off Stack Overflow post
With some ideas pulled from Matt Reid's Google Trends API
FAQs
Simplified Pseudo API for Google Trends
We found that simplifiedpytrends demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.