• Stars
    star
    176
  • Rank 215,752 (Top 5 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created almost 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿฆ Access Twitter data without an API key. [DEPRECATED]

scrape-twitter Build Status npm version

๐Ÿฆ Access Twitter data without an API key

DEPRECATED: The next version of Twitter auto-generates all of the class names and therefore is going to be much more difficult to screen scrape. I might come up with a better solution...


This module provides command line interfaces to scrape: profiles, timelines, connections, likes, search and conversations.

It also exposes both streams and a promise returning function to help accessing Twitter in your own applications.

Real-time firehoses can be created using the companion module monitor-head-stream.

Features

  • Get Twitter data without being required to configure an API key.
  • Twitter can't constrain access as easily as they can to an API or an individual API key. Any constraints introduced would apply to their public site. A scraper can be fixed; you are no longer beholden to Twitter.
  • Grab timelines, whole conversations, profiles, connections, likes, etc.
  • Automatically pages to fetch all tweets.
  • Provides metadata on how tweet replies are linked together. e.g. isReplyToId

Example

Get profile

$ scrape-twitter profile sebinsua
# ...

Get timeline

$ scrape-twitter timeline nouswaves
# ...

Get likes

This command requires a valid login. It will check for the following environment variables: TWITTER_USERNAME, TWITTER_PASSWORD, TWITTER_KDT. But can also pick these up from a dotenv file at the path ~/.scrape-twitter. The first time you login you will be asked to store the TWITTER_KDT - this is used by Twitter to recognise your device.

$ scrape-twitter likes sebinsua
# ...

Get connections

This command also requires a valid login.

$ scrape-twitter connections sebinsua --type=following
# ...

Get conversation

$ scrape-twitter conversation ctbeiser 691766715835924484
# ...

Search

$ scrape-twitter search --query "from:afoolswisdom motivation" --type latest
# ...

Get list

$ scrape-twitter list nouswaves list
# ...

JSON interface plays nicely with CLI tools like jq, coreutils/gshuf and terminal-notifier

For example, a MOTD-like script might contain:

scrape-twitter search --query="from:afoolswisdom knowledge" | jq -r '.[].text' | gshuf -n 1 | terminal-notifier -title "Knowledge (MOTD)"

Install

With yarn:

yarn global add scrape-twitter

With npm:

npm install -g scrape-twitter

API

new TimelineStream(username: string, { retweets: boolean, replies: boolean, count: ?number })

Create a ReadableStream<Tweet> for the timeline of a username.

new LikeStream(username: string, { count: ?number, env: process.env })

Create a ReadableStream<Tweet> for the likes of a username.

new ConnectionStream(username: string, type: 'following' | 'followers', process.env)

Create a ReadableStream<UserConnection> for the connections of a username.

new ConversationStream(username: string, id: string, { count: ?number })

Create a ReadableStream<Tweet> for the conversation that belongs to a username and tweet id.

new ThreadedConversationStream(id: string)

Create a ReadableStream<Tweet> for the thread that belongs to a tweet id.

new TweetStream(query: string, type: 'top' | 'latest', { count: ?number })

Create a ReadableStream<Tweet> for the tweets that match a query and type.

new ListStream(username: string, list: string, { count: ?number })

Create a ReadableStream<Tweet> for the username's list.

getUserProfile(username: string)

Get a Promise<UserProfile> for a particular username.

More Repositories

1

ramda-debug

๐Ÿ Debugging for Ramda.
JavaScript
116
star
2

teller-cli

๐Ÿฆ Banking for your command line [DEPRECATED]
Rust
61
star
3

jstruct

๐Ÿ’ก Quick and easy JSON transformations.
JavaScript
49
star
4

express-keenio

๐Ÿ“Š Rapidly install analytics with a middleware.
JavaScript
42
star
5

redux-saga-helpers

๐Ÿš‘ Error-handling for redux-saga.
JavaScript
23
star
6

tap-debug

๐Ÿบ Debug on tap.
JavaScript
17
star
7

xstate-awaitable-send

Fire an event into an XState `Machine` and then wait for it to resolve.
TypeScript
12
star
8

neo4j-simple

๐Ÿ”ดโž–๐Ÿ”ต Simple nodes, relations, queries.
JavaScript
10
star
9

react-redux-wizard

โœจ A simple wizard for React.
JavaScript
10
star
10

ietf-language-tag-regex

Regular expressions for matching IETF language tags (BCP 47)
JavaScript
8
star
11

monitor-head-stream

๐Ÿ’ฆ Monitor the head of a stream.
JavaScript
7
star
12

conventional-component

๐Ÿด Hoist the state of React components into Redux.
JavaScript
6
star
13

graphviz-config-template

๐ŸŽจ Templates as visual graph configuration.
JavaScript
6
star
14

micrograd-rs

Well-commented `micrograd` implementation in Rust.
Rust
5
star
15

modern-node-app

A modern Node.js backend
TypeScript
4
star
16

react-redux-simple-modal

๐Ÿ”ฑ A simple modal switcher for React.
JavaScript
3
star
17

dotcom

New blog
CSS
3
star
18

k8s-argo-parallel-aggregate-workflow

Given a set of files, we run computations on them in parallel, and finally generate an aggregate result.
3
star
19

learning-haskell

Just using this to work through some tutorials in my spare time...
Haskell
3
star
20

then-while

Call an (a)sync function until an (a)sync predicate returns false.
JavaScript
3
star
21

UIScrollView-StretchyHeader-Example

Programmatic control of Autolayout using iOS8 and Swift.
Swift
3
star
22

2023-interview-prep

๐Ÿ”‘๐Ÿ”‘๐Ÿ”‘ LeetCode, CSES, CodeSignal
Python
2
star
23

cracking-the-coding-interview

๐Ÿคฏ Cracking the Coding Interview in Rust.
Rust
2
star
24

git-in-git

Shell
2
star
25

eventual-schema

Combine objects to generate schemas.
JavaScript
2
star
26

catch-to

Catch errors and declaratively map them to other errors or values.
JavaScript
2
star
27

mu

[shelved] Social release calendar with a music focus.
CSS
1
star
28

get-object-paths

Transforms collections describing paths into arrays of paths.
JavaScript
1
star
29

twitter-force-directed-graph

Clojure
1
star
30

component-horizontal-stacked-bar

A horizontal stacked bar component created with React and d3
JavaScript
1
star
31

chalk-mobile

TypeScript
1
star
32

sebinsua

`README.md`
1
star
33

rollup-resolve-externalised-dynamic-imports

Demonstrating a bug when resolving the module ids of externalised dynamic imports in [email protected]
JavaScript
1
star
34

advent-of-code-2020

Rust
1
star
35

test-react-spring

Finding a bug in `react-spring`
TypeScript
1
star
36

connect-friendwares

A connect helper so that middlewares can see their friends.
JavaScript
1
star
37

scrape-dojo

Scrape Dojo before it goes the way of the Dodo
TypeScript
1
star
38

test-review-notebooks

Test of ReviewNB.
Jupyter Notebook
1
star
39

twitter-market

Ignore for now.
Python
1
star
40

2019-interview-prep

๐Ÿคฏ Random interview prep.
Rust
1
star