{"id":13414048,"url":"https://github.com/groovili/gogtrends","last_synced_at":"2025-06-10T16:09:16.763Z","repository":{"id":34920241,"uuid":"163299949","full_name":"groovili/gogtrends","owner":"groovili","description":"Unofficial Google Trends API for Go","archived":false,"fork":false,"pushed_at":"2023-01-04T02:41:43.000Z","size":3035,"stargazers_count":83,"open_issues_count":3,"forks_count":34,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-27T16:44:24.056Z","etag":null,"topics":["api","api-wrapper","go","golang","golang-package","google-api","google-trends","google-trends-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/groovili.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-27T13:50:34.000Z","updated_at":"2025-02-27T15:54:07.000Z","dependencies_parsed_at":"2023-01-15T10:25:34.418Z","dependency_job_id":null,"html_url":"https://github.com/groovili/gogtrends","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groovili%2Fgogtrends","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groovili%2Fgogtrends/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groovili%2Fgogtrends/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groovili%2Fgogtrends/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/groovili","download_url":"https://codeload.github.com/groovili/gogtrends/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243837011,"owners_count":20355813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-wrapper","go","golang","golang-package","google-api","google-trends","google-trends-api"],"created_at":"2024-07-30T20:01:56.198Z","updated_at":"2025-03-17T02:31:27.330Z","avatar_url":"https://github.com/groovili.png","language":"Go","funding_links":[],"categories":["Third-party APIs","第三方API`第三方API 汇总`","Go","第三方api","第三方API","Utility"],"sub_categories":["Utility/Miscellaneous","查询语","实用程序/Miscellaneous","Fail injection","HTTP Clients"],"readme":"# Google Trends API for Go\n\n###### Unofficial Google Trends API for Golang\n\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/groovili/gogtrends) [![Coverage Status](https://coveralls.io/repos/github/groovili/gogtrends/badge.svg?branch=master)](https://coveralls.io/github/groovili/gogtrends?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/groovili/gogtrends)](https://goreportcard.com/report/github.com/groovili/gogtrends) [![License](https://img.shields.io/badge/licence-MIT-blue.svg)](https://github.com/groovili/gogtrends/blob/master/LICENSE)\n\n**gogtrends** is API wrapper which allows to get reports from Google Trends.\n\nAll contributions, updates and issues are warmly welcome.\n\n### Installation \n\n``go get -u github.com/groovili/gogtrends``\n\n#### Debug\n\nTo see request-response details use `gogtrends.Debug(true)`\n\n#### Usage\n\n**Daily** and **Realtime** trends used as it is. For both methods user interface language are required. For **Realtime** trends category is required param, list of available categories -  **TrendsCategories**.\n\nPlease notice that **Realtime** trends are available only for limited list of locations.\n\n\nFor **InterestOverTime**, **InterestByLocation** and **Related** - widget and user interface language are required.\n\nTo get widget you should call **Explore** methods first, it will return constant list of available widgets, every widget corresponds to methods above.\n\nWidget includes request params and unique token for every method.\n\nAlso **Explore** method supports single and multiple items for comparision. Please take a look at **ExploreRequest** input.\nIt supports search by multiple categories and locations which you can get as tree structure by **ExploreCategories** and **ExploreLocations**.\n\nPlease 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.\n\n### Available methods\n\n* `Daily(ctx context.Context, hl, loc string) ([]*TrendingSearch, error)` - daily trends descending ordered by days and articles corresponding to it.\n\n* `Realtime(ctx context.Context, hl, loc, cat string) ([]*TrendingStory, error)` - represents realtime trends with included articles and sources.\n\n* `Search(ctx context.Context, word, hl string) ([]*KeywordTopic, error)` - Words/Topics related (5 results max) with your search.\n\n* `Explore(ctx context.Context, r *ExploreRequest, hl string) ([]*ExploreWidget, error)` - widgets with **tokens**. Every widget is related to specific method (`InterestOverTime`, `InterestByLocation`, `Related`) and contains required **token** and request information.\n\n* `InterestOverTime(ctx context.Context, w *ExploreWidget, hl string) ([]*Timeline, error)` - interest over time, dots for chart. \n\n* `InterestByLocation(ctx context.Context, w *ExploreWidget, hl string) ([]*GeoMap, error)` - interest by location, list for map with geo codes and interest values.\n\n* `Related(ctx context.Context, w *ExploreWidget, hl string) ([]*RankedKeyword, error)` - related topics or queries, supports two types of widgets.\n\n* `TrendsCategories() map[string]string` - available categories for `Realtime` trends.\n\n* `ExploreCategories(ctx context.Context) (*ExploreCatTree, error)` - tree of categories for explore and comparison. Called once, then returned from cache.\n\n* `ExploreLocations(ctx context.Context) (*ExploreLocTree, error)` - tree of locations for explore and comparison. Called once, then returned from cache.\n\n#### Parameters \n\n* `hl` -  string, user interface language\n\n* `loc` - string, uppercase location (geo) country code, example \"US\" - United States\n\n* `cat` - string, lowercase category for real time trends, example \"all\" - all categories\n\n* `exploreReq` - `ExploreRequest` struct, represents search or comparison items.\n\n* `widget` - `ExploreWidget` struct, specific for every method, can be received by `Explore` method.\n\n### Examples\n\nWorking detailed examples for all methods and cases can be found in ***example*** folder. Short version below.\n\n```go\n// Daily trends\nctx := context.Background()\ndailySearches, err := gogtrends.Daily(ctx, \"EN\", \"US\")\n```\n\n```go\n// Get available trends categories and realtime trends\ncats := gogtrends.TrendsCategories()\nrealtime, err := gogtrends.Realtime(ctx, \"EN\", \"US\", \"all\")\n```\n\n\n```go\n// Explore available widgets for keywords and get all available stats for it\nexplore, err := gogtrends.Explore(ctx, \n\t    \u0026gogtrends.ExploreRequest{\n            ComparisonItems: []*gogtrends.ComparisonItem{\n                {\n                    Keyword: \"Go\",\n                    Geo:     \"US\",\n                    Time:    \"today 12-m\",\n                },\n            },\n            Category: 31, // Programming category\n            Property: \"\",\n        }, \"EN\")\n\n// Interest over time\noverTime, err := gogtrends.InterestOverTime(ctx, explore[0], \"EN\")\n\n// Interest by location\nbyLoc, err := gogtrends.InterestByLocation(ctx, explore[1], \"EN\")\n\n// Related topics for keyword\nrelT, err := gogtrends.Related(ctx, explore[2], \"EN\")\n\n// Related queries for keyword\nrelQ, err := gogtrends.Related(ctx, explore[3], \"EN\")\n\n// Compare keywords interest\ncompare, err := gogtrends.Explore(ctx, \n\t    \u0026gogtrends.ExploreRequest{\n            ComparisonItems: []*gogtrends.ComparisonItem{\n                {\n                    Keyword: \"Go\",\n                    Geo:     \"US\",\n                    Time:    \"today 12-m\",\n                },\n                {\n                    Keyword: \"Python\",\n                    Geo:     \"US\",\n                    Time:    \"today 12-m\",\n                },\n                {\n                    Keyword: \"PHP\",\n                    Geo:     \"US\",\n                    Time:    \"today 12-m\",\n                },                               \n            },\n            Category: 31, // Programming category\n            Property: \"\",\n        }, \"EN\")\n\n```\n\n### Licence\n \nPackage is distributed under [MIT Licence](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroovili%2Fgogtrends","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroovili%2Fgogtrends","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroovili%2Fgogtrends/lists"}