Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/autonome/feed-to-tweet
Send feed content to a Twitter account.
https://github.com/autonome/feed-to-tweet
Last synced: 5 days ago
JSON representation
Send feed content to a Twitter account.
- Host: GitHub
- URL: https://github.com/autonome/feed-to-tweet
- Owner: autonome
- License: mit
- Created: 2017-03-02T05:28:31.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T11:14:06.000Z (about 2 years ago)
- Last Synced: 2024-12-01T12:13:56.981Z (13 days ago)
- Language: JavaScript
- Size: 27.3 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: License.md
Awesome Lists containing this project
README
feed-to-tweet
=========[![NPM](https://nodei.co/npm/feed-to-tweet.png)](https://npmjs.org/package/feed-to-tweet)
Easily power Twitter bots with content feeds.
* Supports multiple source feeds
* Keyword and regular expression filtering against titles to only Tweet the matching items
* Configurable feed checking interval
* Configurable Tweet interval, to reduce flooding
* No persistent storage required
# Usage
1. Install
```
npm install feed-to-tweet
```2. Use in your script
```
var feedToTweet = require('feed-to-tweet');feedToTweet({
feeds: [
{
feedURL: 'http://www.funnycatsite.com/rss/all/'
formatter: function(item) {
return 'OH YOU CATS! ' + item.title + ' ' + item.link;
}
}
],
twitterCfg: {
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
}
});
```# Options
* `feeds`: Array of feed objects. See example above. Formatter is optional.
* `twitterConfig`: Object with Twitter keys and tokens. See example above.
* `searches`: Array of string keywords or string regular expressions. Only items with matching titles are tweeted.
* `checkIntervalMins`: Checks feeds every X minutes (default 60)
* `tweetIntervalSecs`: Waits X seconds between posts to reduce flooding (default 10)
* `debug`: Boolean to print out some debug logging# Evaluation Method
The script checks the feed item's pubDate property, and if the difference
between it and the current time is less than the checkIntervalMins value you
specified, the item will be Tweeted.There's a risk of double-tweets or missed-tweets if you stop and restart the
script, but under normal conditions this method works good enough.# TODO
* Support searching on other fields than title
* Case-sensitive searching