Showcase your 'Medium' Articles in your site !

Showcase your 'Medium' Articles in your site !

Let me give you context first, I have my portfolio website and I write articles in Medium (used to - will let you know where I am doing now at end of this article), and I wanted to showcase those medium articles in my site, but dang ! there aren't any Medium Public Apis from where I can directly fetch from and I was banging my head, after lot of digging I came up with two ways of doing it -

First way - Unofficial Medium API

Found a Unofficial Medium API, The api is pretty sweet, you get almost everything you want ranging from User Data ( User ID, User Articles, User Followers etc etc) as well as other details of Articles, Publications, List, Platform Details etc, but there's a catch to it !

Though the API is free, its only free for 150 calls per month. Dang ! and their paid version via Rapid API is ain't cheap either, I'm not a faang employee bro !

for my use case, this is not gonna work, not economically viable so lets not dig more into this api and head to next way I found (I agree we can fetch only thrice a day and catch the result but nah, I'm lazy to code that much).

Second Way - Medium's RSS FEED !

Quick info for those who don't know what RSS is
RSS is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format. to put it in laymen terms , its just an XML and the provider (medium) in this case keeps updating it whenever there is an update.

Medium provides RSS Feed of your profile at the address of below format and can hit a get request on these address and in response you would get the RSS feed in xml.

okay bud, I got the xml, what's now ?

It's much simple, all you have to do now is to scrape through that xml and fetch out the information you need, it has all your article details, how I did it through was find a npm package which would parse xml-to-json and then consume the data !

keep in mind that the xml part which consists of your article changes the structure when your article structure is changed.

Voila !

What I am doing now ?

Well, This fetching of medium rss feed of my profile didn't give me much satisfaction, I just felt its not much stable mainly due to the fact that the structure of the RSS feed xml might change based on the structure of the article I have written.

This is when I discovered , It is also one of the service like medium but mainly we devs right blogs over it and coolest part if you ask me is - it provides use a way to hook up our profile page of hashnode to our website as a sub domain ! and it even provides apis to fetch our articles and everything !

The current blog which you are reading is written in hashnode itself !