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

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.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

twitter_scraper-0.1.2-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for twitter-scraper-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8397a135cd16f737079cd7e88b7884ab919f6bd76a1e3a9c385c14cfe7fe6155
MD5 6164014f071d3ae88f46e0a72c68dea2
BLAKE2b-256 f1cbdd4569cd186ca00d373758ee24cd0f1b2aa8faa0e5ac890775befbf21d18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for twitter_scraper-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cfe29216c819272d0b14d117540c3c403c8c20d3c674a4c5f5617500ba756c7f
MD5 1fe890a74f9fa6edf2ede31bc46db495
BLAKE2b-256 4403b55d283b7d2a33ea770d3e08d60354de3309cb69f976afd226bf29b13fbf

See more details on using hashes here.

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