DEV Community

Cover image for Creating an RSS Feed for any Medium Thread!
harmankaler2000
harmankaler2000

Posted on

Creating an RSS Feed for any Medium Thread!

I was scrolling through project ideas to do in 30 mins for a quick refresher on the weekend, and stumbled across codementor.io

So, what exactly is an RSS Feed?

RSS stands for Really Simple Syndication — It is a methodology to access the metadata of a website through an XML file.

For example, there are multitudes of articles and publications done on Medium, wouldn’t it be so convenient that all links with the summary available on a single page?

Well the answer to that is — RSS feeds! These were pretty popular a couple of years ago but aren’t really made use of anymore, BUT websites still provide support for you to create your own RSS feed.

Recently I started reading Intermezzo and wanted to read reviews and latest updates on it on Medium, and then I thought maybe I can create an RSS feed for this?

Well, a quick search helped me find out that Medium does support RSS feed creation through their endpoints with the XML metadata of Medium on that particular metadata.

You can find it here - https://help.medium.com/hc/en-us/articles/214874118-Using-RSS-feeds-of-profiles-publications-and-topics

I wrote a quick Python code using the library feedparser — which internally parses the XML file to get the required metadata. I also did the same with BeautifulSoup if you want to parse the metadata on your own as well.

You can checkout the documentation for feedparser here — https://feedparser.readthedocs.io/en/latest/

I parsed and retrieved the medium metadata using the following piece of code —

parsed_feed = feedparser.parse(url)
for article in parsed_feed["entries"]:
    response_article.append({
        "Title": article["title"],
        "Description": html2text.html2text(article["summary"]),
        "Author": article["author"],
        "Date Published": article["published"],
        "Last Updated": article["updated"]
    })
Enter fullscreen mode Exit fullscreen mode

To make it more user friendly I create a quick Python class and had a user input the URL from which the metadata should be received, you can find the link to the complete code on Carbon or Github:

Github: https://github.com/harmankaler2000/RSS_Feeder

Carbon: https://carbon.now.sh/mHN9yVFtZZmkopLHFEe3

Image description

I would love to connect and discuss more on python, please feel free to drop a comment and we can chat!

Top comments (0)