#twitter #bot #tweet #real-time #update #rate-limiting #filter

bin+lib pipitor

A Twitter bot that gathers, filters and Retweets Tweets automatically

17 releases

0.3.0-alpha.15 Nov 14, 2021
0.3.0-alpha.13 Apr 10, 2021
0.3.0-alpha.11 Jan 13, 2021
0.3.0-alpha.9 Nov 28, 2020
0.1.5 Jul 5, 2019

#2001 in Command line utilities

35 downloads per month

AGPL-3.0-only

250KB
6.5K SLoC

Pipitor

Build Status crates.io

Pipitor is a Twitter bot that listens on WebSub/Twitter streams and (re)Tweet the updates in real time.

Overview

Pipitor gathers Atom/RSS feed entries from WebSub (PubSubHubbub) hubs or Tweets from a set of Twitter accounts and (re)Tweets the updates in real time.

You can optionally specify regular expression patterns to filter the updates to (re)Tweet. The regular expression syntax used by Pipitor is documented by the regex crate.

Pipitor uses the streaming API (POST statuses/filter) to retrieve Tweets, which has quite small impact on the rate limit. The rate limit bucket of POST statuses/filter is consumed only once on startup of the bot.

The streaming API, however, is not complete (it misses Tweets on rare occasions) nor extremely fast (there can be a latency of around 5 seconds), so Pipitor also provides an ability to retrieve Tweets from a List. When the List is enabled, Pipitor can deliver a Retweet within a little more than a second of the original Tweet being posted, at the expense of GET lists/statuses's rate limit being exhausted. In addition, when the bot is suspended for some reason, it can retrieve Tweets posted while its suspension from the List on later restart.

Usage

Download the latest binary package for your platform from the releases page and install it to a directory of your choice.

Or alternatively, you can manually build the project from the source:

cargo install pipitor

After the installation, create a configuration file named Pipitor.toml in the working directory. You can use JSON and Dhall (via disabled-by-default dhall feature) formats as well (Pipitor.json and Pipitor.dhall respectively). The config format is documented in CONFIG.md and example configs are shown in Pipitor.example.toml and Pipitor.example.dhall.

Then, run the following, and follow the instructions on the command line. This is needed to retrieve the API credentials for the bot.

pipitor setup

Now, you're all set! Run the following to start the bot:

pipitor run

License

This project is licensed under the GNU Affero General Public License, Version 3 (LICENSE or https://www.gnu.org/licenses/agpl-3.0.html) unless explicitly stated otherwise.

Dependencies

~49–67MB
~1.5M SLoC