Twpy
Twitter High level scraper for humans.
Features
- NO LIMIT, NO API required
- Fast and easy to use
- Working with python 3.5+
- Integrated with pandas for data science research
Installation
Manual install via git :
$ git clone https://github.com/0x0ptim0us/twpy.git
$ cd twpy
$ python setup.py install
Install using pip:
$ pip install twpy
$ python -m pip install twpy
Usage
Create Twpy object :
from twpy import TwpyClient
tc = TwpyClient()
with proxy :
tc = TwpyClient(proxy="127.0.0.1:8080")
Get twpy current version :
tc.__version__
Get user followers:
followers_data = tc.get_followers(username="elonmusk", limit=50, interval=1)
Get user timeline:
tweets = tc.get_timeline(username="elonmusk", limit=50)
Get user profile:
user_info = tc.get_user(username="elonmusk")
Convert result object to other data structures :
from twpy.serializers import to_pandas, to_json, to_list
pandas_sample = to_pandas(followers_data)
json_sample = to_json(followers_data)
list_sample = to_list(followers_data)
Search example:
tweets = tc.search(username="elonmusk", until="2015")
tweets = tc.search(username="elonmusk", until="2015", limit=100, interval=1)
tweets = tc.search(query="love", limit=100, interval=1)
tweets = tc.search(query="love", since="2015-01-01", limit=10)
Supported methods
method | description |
---|
get_friends() | get user followings/friends |
get_timeline() | get user timeline/tweets |
get_user() | get user profile info |
search() | search tweets with query and username |
Meta
Fardin Allahverdinazhand - @0x0ptim0us - 0x0ptim0us@gmail.com Distributed under the MIT license. see LICENSE.txt
for more information.
https://github.com/0x0ptim0us/twpy