Skip to content

Instantly share code, notes, and snippets.

@capjamesg
Created June 24, 2021 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save capjamesg/01e828b4f54d13f15410e4d3216b70bc to your computer and use it in GitHub Desktop.
Save capjamesg/01e828b4f54d13f15410e4d3216b70bc to your computer and use it in GitHub Desktop.
Process OPML files from Feedly OPML export.
# Written by capjamesg
# Required dependencies: requests, beautifulsoup4
from bs4 import BeautifulSoup
import requests
# Please save your opml file as feed.opml before running this program, otherwise you'll encounter an error
with open("feed.opml", "r") as file:
contents = file.read()
soup = BeautifulSoup(contents, "lxml")
# Get a list of all RSS feeds in the file
items = soup.find_all("outline", attrs={"type": "rss"})
for i in items:
# Substitute these values for whatever you want to retrieve from the feed
print("[{}]({}) ([RSS feed]({}))".format(i["text"], i["htmlurl"], i["xmlurl"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment