Skip to main content

InfiniteTrends

contributions welcome Inline docs HitCount

InfiniteTrends is a Python API built upon pytrends to query data from trends.google.com.

Installation

To install with pip, run

pip install InfiniteTrends

You can also clone this repository and run python setup.py install.

Documentation

Interest Over Time For Many Keywords

Use the get_interest_over_time(keywords, region, timeframe, topic_flag) function to list all chart names:

>>> import InfiniteTrends
>>> output = InfiniteTrends.get_interest_over_time(["Harvard University", "Yale University"], "US", "2019-01-01 2020-01-01", True)

The arguments are:

  • keywords – The input terms.
    • Keywords cannot contain duplicates.
    • There is no cap on the number of inputted keywords.
    • All terms are scaled by the 1st (0th index) keyword.
  • region – The geographic region of interest.
    • This is usually a two letter country abbreviation
    • For example, the United States is 'US' and the world is ''
    • There is more detail available for states, provinces, and cities by specifying additonal abbreviations. For example, Alabama is 'US-AL' and England is 'GB-ENG'.
  • timeframe – A string in "YYYY-MM-DD YYYY-MM-DD" that signifies the start and end of the interval of interest.
  • topic_flag – A boolean indicator.
    • If this is FALSE, then keywords will be vanilla "Search Terms" in Google Trends.
    • If this is TRUE, then results will use the first "Topic" that come up when typing in a keyword into the searchbar on the Google Trends website.

Viral Terms Related to One Keyword

Use the get_viral_keywords(keyword, region, timeframe, interval, cutoff) function to return a list of all of the 'Viral' terms that people searching for a keyword also searched for over a period of time.

Definition of a Viral Term: Any keyword related to searches of a master keyword that saw an increase in Google Trends traffic of over cutoff% during at least one period of interval days in a specified region during a longer timeframe. A keyword is related to another if people searching for one often search for another.

>>> import InfiniteTrends
>>> output = InfiniteTrends.get_viral_keywords("Netflix", "US", "2019-01-01 2020-01-01", 7, 300)

The arguments are:

  • keyword – This is the ONE input term.
  • region – The geographic region of interest.
    • This is usually a two letter country abbreviation
    • For example, the United States is 'US' and the world is ''
    • There is more detail available for states, provinces, and cities by specifying additonal abbreviations. For example, Alabama is 'US-AL' and England is 'GB-ENG'.
  • timeframe – A string in "YYYY-MM-DD YYYY-MM-DD" that signifies the start and end of the total interval of interest.
  • interval – The length of time that a keyword has to increase in traffic a cutoff amount. See the Definition of a Viral Term above for a more precise wording.
  • cutoff – An integer indicating the percentage increase in traffic that a keyword related to the master keyword must experience to be recognized as a Viral Term. For example, 100 would indicate 100%.

Made with InfiniteTrends

"Analyzing College Prestige and Virality Through Google Trends". This project and accompanying github repository analyzed interest in colleges and then the clustered viral keywords related to Harvard and MIT specifically. The unsupervised clusterings of the viral topics reflect a divergence in the cultures of the two Cambridge institutions.

Dependencies

Release files for InfiniteTrends 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for InfiniteTrends 0.3
File Size Uploaded
InfiniteTrends-0.3.tar.gz 5.4 kB Details

Release files / InfiniteTrends-0.3.tar.gz

Download URL InfiniteTrends-0.3.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
607cb634b592bcc246343b3950f39f1ee35d6512d62197cba78c38b1893e618f
BLAKE2b-256 checksum
How to use checksums
31b28febbe1c23861094a738c704c1efa82b421a7f9f2d109b61112523a4f4c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page