Provides a basic package structure
Project description
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")
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
Built Distribution
File details
Details for the file mtweepy-1.0.2.tar.gz
.
File metadata
- Download URL: mtweepy-1.0.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 441a431e2e423a561393734ced65a4c1927ef09eb0defddd65069f76ecf8db36 |
|
MD5 | 0baa1c7362abeb2fb8dd1671bcd69d13 |
|
BLAKE2b-256 | 9b89792036ecefc9e9bc52161f96f7a8df6632c883fab5b255e861ab57b66be1 |
File details
Details for the file mtweepy-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: mtweepy-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9705d4bab4aa5ffa9e3fb0ef603b97e32eff0889f2bd9be8cb4ee40f2ffdd39 |
|
MD5 | 195f6e06b831649feed53add02bcbb11 |
|
BLAKE2b-256 | 623bdc908f199c8683372b483ffce268b3b112964875e714a0dcbad7d01c771a |