This package has been deprecated

Author message:

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

twitter-woeid

1.0.3 • Public • Published

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));

Package Sidebar

Install

npm i twitter-woeid

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

38.7 kB

Total Files

5

Last publish

Collaborators

  • vishnumohanrk