{"id":16775046,"url":"https://github.com/masasron/g-trends","last_synced_at":"2025-03-22T00:30:53.358Z","repository":{"id":26398732,"uuid":"108675674","full_name":"masasron/g-trends","owner":"masasron","description":"A simple Node JS client for Google Trends.","archived":false,"fork":false,"pushed_at":"2023-01-06T02:32:23.000Z","size":957,"stargazers_count":25,"open_issues_count":16,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-13T06:51:00.312Z","etag":null,"topics":["extract-trend-data","google","google-trends","googletrends","javascript","node","nodejs","trends"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/masasron.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":"2017-10-28T18:55:18.000Z","updated_at":"2023-12-03T10:54:03.000Z","dependencies_parsed_at":"2023-01-14T04:34:11.516Z","dependency_job_id":null,"html_url":"https://github.com/masasron/g-trends","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fg-trends","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fg-trends/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fg-trends/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fg-trends/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masasron","download_url":"https://codeload.github.com/masasron/g-trends/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221820672,"owners_count":16886222,"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":["extract-trend-data","google","google-trends","googletrends","javascript","node","nodejs","trends"],"created_at":"2024-10-13T06:50:52.067Z","updated_at":"2024-10-28T11:17:37.841Z","avatar_url":"https://github.com/masasron.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# G Trends\nA simple API client for Google Trends.\n\n## Quick Start\n```sh\nnpm install g-trends\n```\n\n## Super simple to use\nG Trends client is designed to be the simplest way for developers to access Google Trends data.\n\n```js\nconst { ExploreTrendRequest } = require('g-trends')\n\nconst explorer = new ExploreTrendRequest()\n\nexplorer.addKeyword('Dream about snakes')\n        .compare('Dream about falling')\n        .download().then( csv =\u003e {\n            console.log('[✔] Done, take a look at your beautiful CSV formatted data!')\n            console.log(csv)\n        }).catch( error =\u003e {\n            console.log('[!] Failed fetching csv data due to an error',error)\n        })\n```\n\n```sh\n[✔] Done, take a look at your beautiful CSV formatted data!\n[ [ 'Day',\n    'Dream about snakes: (Worldwide)',\n    'Dream about falling: (Worldwide)' ],\n  [ '2017-09-29', '26', '58' ],\n  [ '2017-09-30', '68', '88' ],\n  [ '2017-10-01', '57', '100' ],\n  [ '2017-10-02', '72', '60' ],\n  [ '2017-10-03', '65', '70' ],\n  [ '2017-10-04', '35', '55' ],\n  [ '2017-10-05', '55', '58' ],\n  [ '2017-10-06', '34', '80' ],\n  [ '2017-10-07', '66', '69' ],\n  ...\n```\n\n## ExploreTrendRequest\n\n### Method Listing\n\n`normalize()`\n\nthe `normalize` method give you a quick way to overwrite the default normalization function and process the raw Google Trends data before it resolved.\n\n```js\nconst explorer = new ExploreTrendRequest()\nexplorer.normalize( raw =\u003e raw.split(\"\\n\") ).addKeyword('dogs').\n```\n\n`searchProvider()`\n\nThe `searchProvider` method allow you to choose the search provider you wise to extract data from.\n\n```js\n\nconst { ExploreTrendRequest,SearchProviders } = require('g-trends')\n\nconst explorer = new ExploreTrendRequest()\n\n// SearchProviders.News, SearchProviders.Web, SearchProviders.YouTube\n// SearchProviders.GoogleImages, SearchProviders.GoogleShopping\n\nexplorer.searchProvider(SearchProviders.News)\n        .addKeyword('Bitcoin')\n        .download().then( csv =\u003e {\n            console.log('[✔] Done, take a look at your beautiful CSV formatted data!')\n            console.log(csv)\n        }).catch( error =\u003e {\n            console.log('[!] Failed fetching csv data due to an error',error)\n        })\n```\n\n`addKeyword()`\n\nThe `addKeyword` method appends a given keywords to the trend exploration request.\n\n```js\nconst explorer = new ExploreTrendRequest()\n\nexplorer.searchProvider(SearchProviders.News)\n        .addKeyword('Bitcoin')\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`between()`\n\nThe `between` method allows you to extract trend data for a given time period.\n\n```js\nconst explorer = new ExploreTrendRequest()\n\nexplorer.searchProvider(SearchProviders.News)\n        .addKeyword('Bitcoin')\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .between('2017-01-01','2017-01-10')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`pastHour()`\n\nThe `pastHour` method allows you to extract trend data for a the past hour.\n\n```js\nexplorer.pastHour()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`pastFourHours()`\n\nThe `pastFourHours` method allows you to extract trend data for a the past 4 hours.\n\n```js\nexplorer.pastFourHours()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n\n`pastDay()`\n\nThe `pastDay` method allows you to extract trend data for a the past day.\n\n```js\nexplorer.pastDay()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`past7Days()`\n\nThe `past7Days` method allows you to extract trend data for a the past 7 days.\n\n```js\nexplorer.past7Days()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`past30Days()`\n\nThe `past30Days` method allows you to extract trend data for a the past 30 days.\n\n```js\nexplorer.past30Days()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`past90Days()`\n\nThe `past90Days` method allows you to extract trend data for a the past 90 days.\n\n```js\nexplorer.past90Days()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`past12Months()`\n\nThe `past12Months` method allows you to extract trend data for a the past 12 months.\n\n```js\nexplorer.past12Months()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`past5Years()`\n\nThe `past5Years` method allows you to extract trend data for a the past 5 years.\n\n```js\nexplorer.past5Years()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n\n`from2004ToPresent()`\n\nThe `from2004ToPresent` method allows you to extract trend data from 2004 to the present.\n\n```js\nexplorer.from2004ToPresent()\n        .addKeyword('Cats')\n        .addKeyword('Dogs')\n        .download().then( csv =\u003e {\n            console.log(csv)\n        })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasasron%2Fg-trends","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasasron%2Fg-trends","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasasron%2Fg-trends/lists"}