Member-only story

Wrapping the Medium RSS Feed API with Python

Liu Zuo Lin
3 min readAug 8, 2021

--

An Introduction— The Medium RSS Feed

If you didn’t already know, Medium has an RSS feed that provides data (in XML format) for your publications, which is useful if you want to have a list of Medium articles on your personal portfolio website.

This is the URL: https://medium.com/feed/@your-username-here

Replace your-username-here with your own username, and you should get your RSS Feed URL. For instance, my username is zl-liu, so my RSS Feed URL is https://medium.com/feed/@zl-liu .

To test if your RSS feed URL is valid, visit it using your browser, and you should see a bunch of data in XML format, like this:

What data the Medium RSS Feed API provides

  1. Publication titles
  2. Thumbnail images for each publication
  3. A link to your publication on Medium
  4. Publication dates for each publication
  5. A short snippet of your publication you can display on your website
  6. Etc

An example — My publications on my Personal Portfolio Site

Can we get the response in JSON format?

Don’t think so, unless Medium updates the existing API. Hence this short tutorial for anyone who faced this same problem as me a couple of weeks ago.

The Solution

If you don’t want to deal with XML, I’ve written a function that calls your Medium RSS Feed API, processes the XML data, and converts it into a list of dictionaries, which you can easily convert into JSON.

A sample output (in JSON) served through Python FastAPI:

--

--

Liu Zuo Lin
Liu Zuo Lin

Written by Liu Zuo Lin

SWE @ Meta | [Ebook] 101 Things I Never Knew About Python: https://payhip.com/b/vywcf

No responses yet

Write a response