Replacing IFTTT - Part 1: RSS & Tumblr


I've grown to loath IFTTT. What started out as a cool way to plug internet things together has being an opaque an uncommunicative company with no real interest in customer service. That's not surprising, I suppose, its paying customers are the companies who can't be bothered to develop a proper API and so just shove some integrations up there.

But it is annoying for those of us who want something simple - like debug logs or notifications when scripts fail. Or something complex like conditional processing. Or even just a human to talk to when things break.

So, sod the lot of them. I'm slowing replacing my IFTTT "applets" with my own home-brew. Starting with...

RSS & Tumblr

I have a IFTTT recipe which

  1. Reads an RSS feed
  2. If there is a new item, queue it to Tumblr

Simple! And yet IFTTT randomly fails. It either can't read the RSS, or it doesn't spot new items, or it duplicates all my posts. Oh, and there's no way to set queued posts to automatically Tweet. It basically seems that IFTTT's MVP is certainly minimal, but sadly unviable.

This is a Python script which can be run as often as you like. It reads RSS, checks for new items, queues them, and sets Tweet text. NB - no Python 3 support yet because Tumblr can't be bothered to update their libraries.

Prerequisites

The code

import pytumblr
import feedparser
import sys

id_file = "id_file"

# Authenticate via OAuth
tumblr = pytumblr.TumblrRestClient(
        'AAAAA',
        'BBBBB',
        'CCCCC',
        'DDDDD'
)

feed = feedparser.parse('https://EXAMPLE.COM/FEED.RSS')

#       Read the last id
with open(id_file,'r') as file_:
        last_id = file_.read().strip()

most_recent_id = feed['entries'][0]['id']

if (last_id == most_recent_id):
        # Do nothing
        sys.exit()
else:
        #       Save the new ID for later
        with open(id_file, 'w') as file_:
                file_.write(most_recent_id)

        #       Loop through the posts
        for post in feed['entries']:
                #       If the post has been encountered before, time to end things.
                if (last_id == post["id"]):
                        sys.exit()
                else:
                        #       Queue it on Tumblr
                        tumblr.create_text(
                                "YOUR-TUMBLR-NAME",
                                state="queue",
                                title=post["title"].encode("utf-8"),
                                format="html",
                                body=post["summary"].encode("utf-8")
                        )

Running

I have a crontab set up to run this a few times per day. By default, IFTTT seems to check every hour.

Caveats

  • You will need a file called id_file to store the latest ID of the RSS feed.
  • If your RSS feed doesn't have unique IDs, this may not work.
  • This isn't exactly a robust, error-proof solution - but then, neither is IFTTT.

Share this post on…

5 thoughts on “Replacing IFTTT - Part 1: RSS & Tumblr”

    1. Terence Eden says:

      AWS Lambda is interesting - but I'm tired of third party services. If I can't run it on my own machines, I'm at the mercy of Amazon shutting down the service, jacking the price up, or generally being idiots.

      Reply
  1. says:

    zapier and azure logic apps are both options you should look at. Zapier's coming along but is really about enterprise integration. Logic apps are quite simple, but personally, I discovered that they can be expensive if you don't keep an eye on them (you're charged per step).

    AWS Lambda and Azure Function Apps are both good hosting options for scripts which must "just run" - although Azure's python support is awful. I have some C# scripts running on Azure which "just work" (like a twitter bot I built), and having someone else look after the server frees me up to do other things (like hack together my code until it works). Azure Function Apps can be stupidly cheap too - you get millions of executions per month for basically zero.

    Reply
  2. dmz says:

    Not to mention that IFTTT's ingredients stopped working ages ago. The text "Via RSS Feed" and the "EntryPublished" ingredient seem to be hard-coded, since the frontend received a major overhaul.

    Reply

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">