haskell-google-trends

Simple library for accessing Google Trends https://github.com/grzegorzgoldapl/haskell-google-trends

Latest on Hackage:0.0.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

PublicDomain licensed by grzegorzgoldapl

Very simple library for accessing Google Trends

INSTALL

cabal install haskell-google-trends

HOW TO USE

Currently library exports two functions. Both return maybe a list of tuples of form (Year, Month, Value).

queryTrendsWithLogin :: String -> String -> Maybe (String, Int) -> String -> IO (Maybe [(Integer, String, Integer)])
queryTrendsWithLogin email password maybeProxy keywords

queryTrendsNoLogin :: Maybe (String, Int) -> String -> IO (Maybe [(Integer, String, Integer)])
queryTrendsNoLogin maybeProxy keywords

Example (No proxy):

import Google.Trends

main = do
    Just results <- queryTrendsWithLogin "your-login@gmail.com" "password" Nothing "pizza"
    print [(month, value) | (year, month, value) <- results, year == 2010]

Example (With proxy):

import Google.Trends

main = do
    Just results <- queryTrendsNoLogin (Just ("54.153.7.21", 8083)) "pizza"
    print [(month, value) | (year, month, value) <- results, year == 2010]
comments powered byDisqus