Skip to main content

Collection of twitter scripts

Project description

## twitter-utils

Collection of twitter utilities.

### Installation

` $ pip install twitter-utils `

### Usage

The following sub-commands are currently implemented

#### tweets_between

Download all tweet identifiers for an account between given dates. Stores all tweet identifies in a file with the format “<twitter-handle>-<since-date>-<until-date>.txt”.

Sample run: ` $ twitter-utils tweets-between --account DashCamTwats --since 2020-04-10 --until 2020-04-25 ✅ Search URL: https://twitter.com/search?q=(from%3ADashCamTwats)%20until%3A2020-05-19%20since%3A2020-04-10&src=typed_query ... (progress) ✅ Total tweets: 114 📝 Tweets(identifiers) written in DashCamTwats_2020-04-10_2020-04-25.txt `

#### parent_tweet

Find the parent tweet if you provide a reply of the original tweet. It prints the parent tweet URL along with Twitter handle and status identifier.

Sample run: ` $ twitter-utils parent-tweet --account plastered41 --tweetid 1259071349152272386 ✅ Replied Tweet URL: https://twitter.com/plastered41/status/1259071349152272386 👉 Parent Tweet URL: https://twitter.com/DashCamTwats/status/1259057703286116352 📝 Parent Tweet Handle: DashCamTwats, Status Id: 1259057703286116352 `

#### download_replies

Find all the replies of a given tweet. Stores all tweet identifies in a file with the format “<twitter-handle>-<status-id>.txt”.

Sample run: ` $ twitter-utils download-replies --account DashCamTwats --tweetid 1259057703286116352 ✅ Tweet URL: https://twitter.com/DashCamTwats/status/1259057703286116352 ... (progress) 🤩 Looks like we are done ✅ Total tweets: 41 📝 Replies(identifiers) written in DashCamTwats_1259057703286116352.txt `

#### Selecting WebDriver

twitter-utils uses Firefox by default but it can be overridden by providing an alternate browser. Currently only supporting Firefox, Safari and Chrome.

To use Safari instead of Firefox, pass the –browser option before specifying the sub-command.

` twitter-utils --browser safari ... `

And to use Chrome

` twitter-utils --browser chrome ... `

### Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

You’ll need a working version of Python3 to run these scripts.

  1. Create and use new virtual env

` python3 -m venv venv source venv/bin/activate `

  1. Install required dependencies

` $ pip install -r requirements.txt `

  1. Run locally

` $ python local_main.py ... `

### Publishing Updates to PyPi

`shell $ make package `

Enter the username and password for pypi.org repo when prompted

### License

[MIT](https://choosealicense.com/licenses/mit/)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twitter-utils-0.1.20200510.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file twitter-utils-0.1.20200510.tar.gz.

File metadata

  • Download URL: twitter-utils-0.1.20200510.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/2.7.18

File hashes

Hashes for twitter-utils-0.1.20200510.tar.gz
Algorithm Hash digest
SHA256 b628d4388d480e77e55591647a6c1fb898ff4006cc25d67e567259c52ee87907
MD5 e167b4026414679a3e66e01a50a6897d
BLAKE2b-256 0d839f197206a7ec8245bbcfd3d5239a161bdfbc4c4f9d8534e52430c6df500a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page