
This is a huge JSON response, over 1mb, and you can manipulate the geo and date parameters to see the results of these top charts over time and location. For example, recent trending keywords for Actors in United States could be retrieved with the following POST request:Ĭurl -data "ajax=1&cid=actors&geo=US&date=201310" If you are interested in just trending data for a specific category, you can call the topcharts/trendingchart URI and retrieve that specific information. I have done a lot of research around trends and even looked across other channels in the past so I find these calls really helpful. Explore( ctx,ĬomparisonItems: *gogtrends.I would love to hear more about how others are using this data, so drop a comment below.Google Trends does not have an API, but Google Trends Scraper creates an unofficial Google Trends API to let you extract data from Google Trends directly and at scale. Explore available widgets for keywords and get all available stats for it explore, err := gogtrends. Working detailed examples for all methods and cases can be found in example folder. Widget - ExploreWidget struct, specific for every method, can be received by Explore method. Loc - string, uppercase location (geo) country code, example "US" - United StatesĬat - string, lowercase category for real time trends, example "all" - all categoriesĮxploreReq - ExploreRequest struct, represents search or comparison items. Called once, then returned from cache.ĮxploreLocations(ctx context.Context) (*ExploreLocTree, error) - tree of locations for explore and comparison. TrendsCategories() mapstring - available categories for Realtime trends.ĮxploreCategories(ctx context.Context) (*ExploreCatTree, error) - tree of categories for explore and comparison. Related(ctx context.Context, w *ExploreWidget, hl string) (*RankedKeyword, error) - related topics or queries, supports two types of widgets. InterestByLocation(ctx context.Context, w *ExploreWidget, hl string) (*GeoMap, error) - interest by location, list for map with geo codes and interest values. InterestOverTime(ctx context.Context, w *ExploreWidget, hl string) (*Timeline, error) - interest over time, dots for chart. Every widget is related to specific method ( InterestOverTime, InterestByLocation, Related) and contains required token and request information.

Search(ctx context.Context, word, hl string) (*KeywordTopic, error) - Words/Topics related (5 results max) with your search.Įxplore(ctx context.Context, r *ExploreRequest, hl string) (*ExploreWidget, error) - widgets with tokens. Realtime(ctx context.Context, hl, loc, cat string) (*TrendingStory, error) - represents realtime trends with included articles and sources. Available methodsĭaily(ctx context.Context, hl, loc string) (*TrendingSearch, error) - daily trends descending ordered by days and articles corresponding to it. Please notice, when you call Explore method for keywords comparison, two first widgets would be for all of compared items, next widgets would be for each of individual items. It supports search by multiple categories and locations which you can get as tree structure by ExploreCategories and ExploreLocations. Please take a look at ExploreRequest input. Widget includes request params and unique token for every method.Īlso Explore method supports single and multiple items for comparision. To get widget you should call Explore methods first, it will return constant list of available widgets, every widget corresponds to methods above. Please notice that Realtime trends are available only for limited list of locations.įor InterestOverTime, InterestByLocation and Related - widget and user interface language are required. For Realtime trends category is required param, list of available categories - TrendsCategories. For both methods user interface language are required. To see request-response details use gogtrends.Debug(true) Usageĭaily and Realtime trends used as it is.

Gogtrends is API wrapper which allows to get reports from Google Trends.Īll contributions, updates and issues are warmly welcome. Google Trends API for Go Unofficial Google Trends API for Golang
