bridges rss with twitter or even with generic commands

boyska 07a3569e86 FIX: collect subcmd stdout/stderr 4 years ago
app 07a3569e86 FIX: collect subcmd stdout/stderr 4 years ago
vendor dae3633fe4 fix max size issue with text 5 years ago
.gitignore b1dc239277 switch logging to lgr 5 years ago
.travis.yml 742356b3b6 remove vendor flag, not using modules yet 5 years ago
Dockerfile 69b6970f4e add lint deaadline 5 years ago
Gopkg.lock dae3633fe4 fix max size issue with text 5 years ago
Gopkg.toml b1dc239277 switch logging to lgr 5 years ago
LICENSE 97f7122286 new licensing 4 years ago
README.md 24189a5e5c changed Install howto 4 years ago
docker-compose.yml ad29bfa236 comment dry run in compose 5 years ago

README.md

rss2twitter Go Report Card

( Fork of https://github.com/umputun/rss2twitter )

The service publishes RSS updates to twitter. The reason is simple - I needed self-hosted thingy to post tweets on a feed change for my sites (podcasts and blogs). Tried several "cloud services" for this and lately switched to IFTTT. It worked, but slow and unreliable. Sometimes it took hours to get twit posted, sometimes I had to trigger it manually. In addition IFTTT can't have multiple twitter accounts defined for the same IFTTT account and I had to deal with multiple IFTTT accounts just to post to different twitter's timelines.

Install

cd app; go install ./...

Templates

--template parameter (env $TEMPLATE) defines output tweet's format with:

  • {{.Title}} - title fo rss item (entry)
  • {{.Link}} - rss link
  • {{.Text}} - item description

default is {{.Title}} - {{.Link}}

Parameters

Application Options:
  -r, --refresh=         refresh interval (default: 30s) [$REFRESH]
  -t, --timeout=         rss feed timeout (default: 5s) [$TIMEOUT]
  -f, --feed=            rss feed url [$FEED]
      --consumer-key=    twitter consumer key [$TWI_CONSUMER_KEY]
      --consumer-secret= twitter consumer secret [$TWI_CONSUMER_SECRET]
      --access-token=    twitter access token [$TWI_ACCESS_TOKEN]
      --access-secret=   twitter access secret [$TWI_ACCESS_SECRET]
      --template=        twitter message template (default: {{.Title}} - {{.Link}}) [$TEMPLATE]
      --dry              dry mode [$DRY]
      --dbg              debug mode [$DEBUG]
  • refresh interval defines how often RSS feed will be checked and restricts the minimal time interval between two tweets.
  • values for refresh and timeout should be presented with units "d" (days), "h" (hours), "m" (minutes) os "s" (seconds)
  • dry disables publishing to twitter and sends updates to logger only

rss2cmd

getting the core out of rss2twitter, I created rss2cmd. It's a simple program that monitors a RSS feed but, instead of pushing to twitter, calls the command you tell it to.

Typical usage:

rss2cmd -f http://mysite.com/feed.xml -- ./myscript --blah

my script will receive post data in the form of environment variables. Every metadata, except the body, is passed like that. The body, instead, is passed via stdin.