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
# or
$ python -m pip install twpy
Usage
Create Twpy object :
from twpy import TwpyClient
# create twpy client object
tc = TwpyClient()
with proxy :
# or you can pass proxy
tc = TwpyClient(proxy="127.0.0.1:8080")
Get twpy current version :
tc.__version__
# '1.2.4'
Get user followers:
# get user followers, limited up to 50
# interval : delay between each request, default is 0 for no delay
# proxy : send traffic through proxy, default is none
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
# convert result to pandas data frame, json and list
# pandas
pandas_sample = to_pandas(followers_data)
# json
json_sample = to_json(followers_data)
# list
list_sample = to_list(followers_data)
Search example:
# search user tweets until 2015
tweets = tc.search(username="elonmusk", until="2015")
# add limit and interval
tweets = tc.search(username="elonmusk", until="2015", limit=100, interval=1)
# search tweets contains `love` word
tweets = tc.search(query="love", limit=100, interval=1)
# search tweets which contains `love` word and were tweeted since 2015-01-01
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.
Metadata
Release files for twpy 1.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| twpy-1.2.5.tar.gz | 9.1 kB | Without provenance | Details for twpy-1.2.5.tar.gz |
Release files / twpy-1.2.5.tar.gz
| Download URL | twpy-1.2.5.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
065dabb6cca6a7209443c3f5ab78aeb5b9bd54071b9d10397e7b74e15857183f
|
|
BLAKE2b-256 checksum How to use checksums |
955e859d633df3dde3721b9acd623535defb31e9eea497f8cff78113199e0b1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 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
|
Security for twpy 1.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.