JSPM

twitter-scrape-account-stats

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q29857F
  • License GPL-3.0

scrape public Twitter data w/out API access

Package Exports

  • twitter-scrape-account-stats

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (twitter-scrape-account-stats) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Twitter Scrape Account Stats

Build Status NPM version NPM license

A tool for scraping public data from Twitter, without needing to get permission from Twitter. It scrapes the following fields:

  • description
  • followers
  • following
  • isVerified
  • name
  • posts
  • userId
  • username

See lib/response.schema.json for further details.

Example

CLI

The CLI operates entirely over STDOUT, and will output the account stats as JSON.

$ twitter-scrape-account-stats -u slang800
{"description":"","followers":97,"following":102,"isVerified":false,"name":"Sean Lang","userId":"1343446141","username":"slang800","posts":65}

JavaScript Module

The following example is in CoffeeScript.

{getAccountStats} = require 'twitter-scrape-account-stats'

getAccountStats(username: 'slang800').then((account) ->
  console.log "#{account.username} has #{account.followers} followers."
)

The following example is the same as the last one, but in JavaScript.

var getAccountStats = require('twitter-scrape-account-stats').getAccountStats;

getAccountStats({username: 'slang800'}).then(function(account) {
  console.log(account.username + " has " + account.followers + " followers.");
});

Why?

Twitter doesn't provide an open, structured, and machine readable API, so, we're forced to scrape their user-facing site.

Caveats

  • This is probably against the Twitter TOS, so don't use it if that sort of thing worries you.
  • Whenever Twitter updates certain parts of their front-end this scraper will need to be updated to support the new API.
  • You can't scrape protected accounts (cause it's not public duh).