A lightweight library for scraping Twitter data.
Project description
Tweezers
Lightweight Python library for scraping data via the Twitter search API.
from tweezers import Tweezers
Create an instance of Tweezers with API credentials
# Loading Twitter auth credentials from a local JSON file. Get yours here:
# https://developer.twitter.com/en/apps/
import json
import os
fp = os.path.join(os.getcwd(), "credentials.json")
with open(fp) as f:
credentials = json.load(f)
t = Tweezers(
api_key=credentials["api_key"],
api_secret_key=credentials["api_secret_key"],
access_token=credentials["access_token"],
access_token_secret=credentials["access_token_secret"]
)
Perform a search
Searching returns an instance of a class TweezerSearch
, which contains various data attributes returned by the Twitter API:
s = t.search(search_term="bitcoin", total=1000, result_type="recent")
# All the tweet results are returned in a Pandas DataFrame:
s.results_df.head()
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
tweezers-0.0.2.tar.gz
(10.7 kB
view details)
Built Distribution
File details
Details for the file tweezers-0.0.2.tar.gz
.
File metadata
- Download URL: tweezers-0.0.2.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7c3d89bd5db080cf1631e2c1f5a941f17ef06cb54b005035c2dd8ce5b7ea183 |
|
MD5 | 6c823ddbedbd465c75166b3f7c29c6d9 |
|
BLAKE2b-256 | 1c7a30491ccdf248a568bce80997649262420539eeb067d3108f9caa8a3eb0d8 |
File details
Details for the file tweezers-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: tweezers-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da528347ad14ee38719b2d4ba75ea8dc5154a6de7884a4e3f47c9cfbfbc3a549 |
|
MD5 | dcd5c293635026b6f7ff9a5077998381 |
|
BLAKE2b-256 | a9f0896ce5c134ec94a6852f90243b081a816c2723ebcb4be461b04824048b8d |