Code Monkey home page Code Monkey logo

pytrends's Introduction

pytrends

About

Pseudo API for Google Trends

  • Allows simple interface for automating downloads of csv reports from Google Trends.

  • Main feature is to help trick google into thinking the script is actually a browser.

  • Only good until Google changes their backend again :-P

Requirements

  • Written for Python 3.3, probably works for 3.x.
  • Requires a google account to use.

Connect to Google

pyGTrends(google_username, google_password)

Parameters

  • google_username
    • a valid gmail address
  • google_password
    • password for the gmail account

Request a Report

request_report(keywords, hl='en-US', cat=None, geo=None, date=None, use_topic=False)

Parameters

  • keywords
    • the words to get data for
    • Example "Pizza"
    • Alternately: "Pizza + Italian"
    • Alternately: "iron - chemical element" topic name is "%2Fm%2F025rw19" and needs use_topics=True
  • hl
    • language
    • find available parameters by inspecting the url when manually using Google Trends
    • defaults to US english
  • cat
    • category
    • find available parameters by inspecting the url when manually using Google Trends
    • defaults to none
  • geo
    • geographical area
    • find available parameters by inspecting the url when manually using Google Trends
    • defaults to world
  • date
    • date to start from
    • defaults to all available data
    • "MM/YYYY #m" where # is the number of months from that date to pull data for
    • "10/2009 61m" would get data from October 2009 to October 2014
  • use_topic
    • set to true to avoid URLencoding the keywords

Save a Report to file

save_csv(path, trend_name)

Parameters

  • path
    • output path
  • trend_name
    • human readable name for file

Credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.