New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

twitter-woeid

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

twitter-woeid

Get WOEID for locations that Twitter has trending topic information for.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 02 Mar 2023

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