Skip to content

Instantly share code, notes, and snippets.

@capjamesg
Created Jun 24, 2021
Embed
What would you like to do?
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