Twitter crawler to download a followers graph and statuses into a local database.
Project description
twcrawl - Twitter Network Crawler
Starts at any given Twitter accounts (for example realDonaldTrump
and
elonmusk
) and follows their relationships to download the profiles of all
Twitter users into a local database for later batch processing (like
analyzing the social sentiment).
Note: This crawler has been designed to prioritize crawling of accounts with the most followers. Depending on your use case you might need to first tweak the parameters a bit.
Setup
All required dependencies are defined in the requirements.txt
file. Run
pip install -r requirements.txt
to install all of them if needed. Then copy
the config.example.json
into a config.json
and fill in your Twitter
API credentials.
Usage
Simply run src/main.py --users users.txt
. users.txt
should be
a list of twitter handles to use as entry points of the crawling process, one
per each line of the text file.
This will launch an endless running process, which crawls as many users as
possible (and as fast as allowed by the Twitter API limits). You can pause the
process by simply killing it and continue the crawling process by starting it
again by executing src/main.py
again (no more need for the -i
parameter).
The crawled database will be stored into data/twitter.sqlite3
(or anywhere
else if you override the default values in your config file).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file twcrawl-1.0.3.tar.gz
.
File metadata
- Download URL: twcrawl-1.0.3.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6db6d34e1271d6c6001af208fbc59f63e394a1a59d702999a12a03c830337df1 |
|
MD5 | d39ea22b04207c085e2a05447a42974c |
|
BLAKE2b-256 | 380e381e5628b1f107722d3bdabd4da1dde95c433ca5831735ceb77540dccd9b |