Skip to main content

Scrape the Twitter Frontend API without authentication.

Project description

Twitter Scraper

Twitter’s API is annoying to work with, and has lots of limitations — luckily their frontend (JavaScript) has it’s own API, which I reverse–engineered. No API rate limits. No restrictions. Extremely fast.

You can use this library to get the text of any user’s Tweets trivially.

Very useful for making markov chains.

Usage

>>> from twitter_scraper import get_tweets

>>> for tweet in get_tweets('kennethreitz', pages=1):
>>>     print(tweet['text'])
P.S. your API is a user interface
s3monkey just hit 100 github stars! Thanks, y’all!
I’m not sure what this /dev/fd/5 business is, but it’s driving me up the wall.
…

It appears you can ask for up to 25 pages of tweets reliably (~486 tweets).

Markov Example

First, install markovify:

$ pipenv install markovify
>>> import markovify

>>> tweets = '\n'.join([t['text'] for t in get_tweets('kennethreitz', pages=25)])
>>> text_model = markovify.Text(tweets)

>>> print(text_model.make_short_sentence(140))
Wtf you can’t use APFS on a prototype for “django-heroku”, which does a lot out of me.

Installation

$ pipenv install twitter-scraper

Only Python 3.6+ is supported

LICENSE

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twitter-scraper-0.3.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

twitter_scraper-0.3.0-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file twitter-scraper-0.3.0.tar.gz.

File metadata

File hashes

Hashes for twitter-scraper-0.3.0.tar.gz
Algorithm Hash digest
SHA256 405bcaed6e5eaf95d798101d0ce61b237314366d91f56997146ec6b098751bee
MD5 4b24dff562feeebd7d29559b4de76319
BLAKE2b-256 e0909eb2ccd0bb02ad91ed11ef0bd32ae3d90c502b396fb6ec584a66a661226b

See more details on using hashes here.

Provenance

File details

Details for the file twitter_scraper-0.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for twitter_scraper-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 05a68592a966dde41332499105f9faa93b69e6f622c2ef1d68c767e8629bf551
MD5 ad61f74b5904ba12f919d4678d93da6b
BLAKE2b-256 8e455956a93dea033407dfd160497f7965ec3785b15b1f8cfbf3c3327e768b08

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page