PYTHON

How to export OPML from Omnivore

Omnivore recently announced they were bought by ElevenLabs, which is an AI company funded by Trump-supporting VC firm Andreessen Horowitz.
As a part of this deal, they are shuttering the service on an extremely tight deadline.

This is very disappointing to me, I’ve previously recommended Omnivore to others and have donated for the past year that I’ve used the service.
It goes without saying that I want nothing to do with Omnivore.

At the recommendation of a few friends I am going to try out Feedbin, which costs $5/month (the same price that I was willing to donate to Omnivore)
and has a generous 30-day trial. This service has been around for much longer and appears to not be adding AI garbage to their app (thank you, Feedbin!)

The Omnivore team has unhelpfully given an extremely tight deadline to migrate your content out before they shutter the service: November 15th.
Exporting your content (links, tags, rendered HTML pages) worked fine for me but I had to restart the export process once. Please do this ASAP to avoid losing your data.

I will need to write a few scripts to import the content into Feedbin. But your data export doesn’t give you your RSS or newsletter subscriptions (again, screw you Omnivore).

So I wrote a short Python script to do that. First install the dependencies (OmnivoreQL and PyOPML):

$ python -m pip install omnivoreql pyopml

You’ll also need to create an Omnivore API token and place the value in the script:

import opml
from omnivoreql import OmnivoreQL

omnivore_api_token = "<YOUR API TOKEN GOES HERE>"

omnivore = OmnivoreQL(api_token=omnivore_api_token)
subscriptions = omnivore.get_subscriptions()

with open("newsletters.txt", mode="w") as newsletters_fileobj:
    newsletters_fileobj.truncate()
    feeds_opml = opml.OpmlDocument(
        title="Omnivore Feeds Export"
    )

    for subscription in subscriptions["subscriptions"]["subscriptions"]:
        if subscription["newsletterEmail"] is not None:
            newsletters_fileobj.write(subscription["name"] + "\n")
        else:
            feeds_opml.add_rss(
                text=subscription["name"],
                title=subscription["name"],
                xml_url=subscription["url"],
                description=subscription["description"],
            )

with open("feeds.opml", mode="wb") as feeds_fileobj:
    feeds_fileobj.truncate()
    feeds_opml.dump(feeds_fileobj, pretty=True)

After running the script you’ll have two files: feeds.opml and newsletters.txt.

The feeds.opml file can be imported into RSS readers that support the OPML format (Feedbin and many other services do).

The newsletters.txt file is mostly to remind you which newsletters you’ve subscribed to. Because these readers use custom email addresses to handle newsletters
you’ll need to manually set these subscriptions up on the new reader service you choose to use.

If there’s any issues with the script above, get in contact and I’ll try to fix any issues.

Have thoughts or questions? Let’s chat over email or social:

sethmichaellarson@gmail.com
@sethmlarson@fosstodon.org

Want more articles like this one?
Get notified of new posts by subscribing to the RSS feed or the email newsletter.
I won’t share your email or send spam, only whatever this is!

Want more content now? This blog’s archive has 95 ready-to-read articles. I also curate
a list of cool URLs I find on the internet.

Find a typo? This blog is open source, pull requests are appreciated.

Thanks for reading! ♡ This work is licensed under CC BY-SA 4.0

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button