Makes twitter scrapping with multiple twitters apps easy again!
Support me
Install from PyPi
pip3 install mtweepy
Or Install from main branch
pip3 install git+https://github.com/Souvic/mtweepy.git
Example usage
There are three functions in the repo: get_followers, get_timelines, get_users.
All the functions use all the auth tokens optimally for fastest scraping.
Apart from self explantory inputs:
- As auths, a list of tweepy bearer tokens are expected if you want to use oauth2 limits for twitter api.
- As auths, a list of [oauth_consumer_key, oauth_consumer_secret, client_secret, oauth_token, oauth_token_secret] are expected if you want to use oauth1 limits for twitter api.
- use_userid parameter is by default False. If it is passed as True in get_followers, get_followers will treat the screen_name_or_userid parameter as userid for which follower is to be scraped.
- output_folder is supposed to be an empty folder to save output from get_timelines and get_users functions.
An example usage is provided here.
Gets 5000*ceil(max_num/5000) number of followers' userids as a list for screen_name INCIndia
from mtweepy import get_followers, get_users, get_timelines
list_followers= get_followers(auths, "INCIndia", max_num=500)#gets list of followers appended in chunk of 5000, if max_num<5000, will get last 5000 followers.
Gets all the maximally extended user objects for list_followers(a list of user ids)
The output is saved in the output_folder as multiple jsonl files(one file per access token). Each line of jsonl files contains the maximally extended user object for one user.
get_users(auths, list_followers, output_folder="./testfolder1")
Gets all the tweets in the timelines of list_followers(a list of user ids)
The output is saved in the output_folder as multiple jsonl files(one file per access token). Each line of jsonl files contains last 3200 tweets of a user.
get_timelines(auths, list_followers, output_folder="./testfolder2")
Metadata
Release files for mtweepy 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mtweepy-1.0.2.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mtweepy-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.8 kB
Release files / mtweepy-1.0.2.tar.gz
| Download URL | mtweepy-1.0.2.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
441a431e2e423a561393734ced65a4c1927ef09eb0defddd65069f76ecf8db36
|
|
BLAKE2b-256 checksum How to use checksums |
9b89792036ecefc9e9bc52161f96f7a8df6632c883fab5b255e861ab57b66be1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.13
|
Release files / mtweepy-1.0.2-py3-none-any.whl
| Download URL | mtweepy-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9705d4bab4aa5ffa9e3fb0ef603b97e32eff0889f2bd9be8cb4ee40f2ffdd39
|
|
BLAKE2b-256 checksum How to use checksums |
623bdc908f199c8683372b483ffce268b3b112964875e714a0dcbad7d01c771a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.13
|