Process OPML files from Feedly OPML export.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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