Giter Club home page Giter Club logo

twitter-woeid's Introduction

Twitter WOEID

1.0.3 Update - This package might not be useful - Instead use trends/available endpoint directly.

Twitter uses Yahoo! WOEID for all of their Trends related API endpoints. But that Yahoo! service has been shutdown.

This NPM module offers methods to get WOEID of all locations that Twitter has trending topic information for.

Contents:

Methods

Example

Using with Twit

Available Methods

getSingleWOEID(cityName)

Use the above method for getting the WOEID of a City (Local Trends).

Use the above method for getting the WOEID of a Country (National Trends).

getAllWOEID(countryName)

Use the above method for getting the WOEIDs of all cities (that Twitter has trending topic information for) of that country.

Each of the above methods returns an array of matching city/country.

Example

City

console.log(getSingleWOEID('new york'));

// RETURNS

[{ name: 'New York', country: 'United States', woeid: 2459115 }];

Country

console.log(getSingleWOEID('india'));

// RETURNS

[{ name: 'India', country: 'India', woeid: 23424848 }];

All (Available) cities of a Country

console.log(getAllWOEID('japan'));

// RETURNS

[
  { name: 'Kitakyushu', country: 'Japan', woeid: 1110809 },
  { name: 'Saitama', country: 'Japan', woeid: 1116753 },
  ...
  { name: 'Okayama', country: 'Japan', woeid: 90036018 },
];

Usage with Twit

Using destructuring

const [{ woeid }] = getSingleWOEID('chennai');

twit.get('trends/place', { id: woeid })
  .then(res => console.log(res.data[0]))
  .catch(e => console.log(e));

twitter-woeid's People

Contributors

vishnumohanrk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

nemoralis anyungu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.