Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-google-search-trends

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-google-search-trends

API to retrieve JSON data from Google Search Trends with localization

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Node.js module to grab Google's trending searches from the official Atom feed. It returns data more or less identical to this page, using any localized version of this feed, without all the clutter that comes with XML feeds.

This module was written to pull interesting discussion topics into Quibbler. It is intended for use in similar use cases, like in an application that can benefit from having a list of trending topics (that only needs to change occasionally). But feel free to try out innovative things with it.

Contact me @Antrikshy with any questions, feedback or bugs.

Note: This module does not let you analyze Google Trends data for specific keywords, and nor does it provide you their search trends over time. This is just a simple tool to get keywords from Google's "Trending Searches" (which may get rebranded over time, and I will try to keep this notice up to date to avoid confusion) so you don't have to parse the feed yourself.

Usage

As always, install using:

npm install node-google-search-trends [--save]

The module comes with one exposed function. It takes three parameters - localization, count and callback. Example usage:

var trends = require('node-google-search-trends');
trends('Singapore', 10, function(err, data) {
    if (err) return console.err(err);
    console.log(JSON.stringify(data, null, 2));  // Pretty prints JSON 'data'
});

Google only seems to store a maximum of 20 recent trends, so count is capped at 20. Also, the serial order of search trends on the website may differ from returned data, because that's how Google's feed is.

Here's an example of the data object:

{
  '0': {
    title: [
      'Comcast'
    ],
    description: [
      ''
    ],
    link: [
      'http://www.google.com/trends/hottrends?pn=p1#a=20150327-Comcast'
    ],
    pubDate: [
      'Fri, 27 Mar 2015 00:00:00 -0700'
    ],
    'ht:picture': [
      '//t2.gstatic.com/images?q=tbn:ANd9GcQ336KOFcezbrMJXlGqQ0wko4C1RjXwhLCS-zYLh0SJB_i_qdiYej-mNPKG4pv-SipOZK8K7daS'
    ],
    'ht:picture_source': [
      'Gawker'
    ],
    'ht:approx_traffic': [
      '50,000+'
    ],
    'ht:news_item': [
      [Object],
      [Object]
    ]
  }
}

Potentially useful items are title (the actual trending keyword), link (to the Trends page), pubDate (when the trending item was added to the feed). ht:picture is an image automatically assigned to the trend, displayed on the Trends site linked above.

Contribute

It's a pretty simple module to contribute to, if you know Node.js basics. Just clone the repo and make a script inside the folder to test responses using require('./trends.js'). Any fixes, cleanup or new features are always appreciated.

Keywords

FAQs

Package last updated on 18 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc