meed

Medium RSS feeds for the masses.

Download GitHub

tl;dr

Meed is a JavaScript library for getting Medium RSS feeds as JSON. It’s written in JavaScript utilizing fetch & async / await bundled as a UMD module so it can be used in a modern browser or Node.js environment. You can get the feed for any user, publication, topic, or tag.

Features

  • fetch (native or polyfilled)
  • Promise-based (async / await)
  • Modern browsers & Node.js

Limitations

  • 10 item RSS limit (by Medium)

Demo

See the Pen Meed demo by Paul Esch-Laurent (@Pinjasaur) on CodePen.

Usage

  1. Install with yarn/npm, a CDN, or the latest release.

    yarn add meed # yarn
    npm install meed # npm
  2. Add the script to your markup.

    <script src="path/to/meed.js"></script>

    Or to your Node.js environment.

    const Meed = require("meed")
  3. Create a new instance.

    const feed = new Meed()

    In Node.js, bring your own fetch.

    const fetch = require("node-fetch")
    const feed = new Meed({ fetch })
  4. Grab a feed.

    (async () => {
      const user = await feed.user("Medium")
      console.log(user)
    })()

API

At a high level, you create a new Meed instance and then call one of the methods. A “feed” refers to an array of formatted objects.

Error handling for the await calls is left up to the author. A standard try..catch block will suffice or a utility like await-to-js will work as well.

Meed([options])

Create a new instance, optionally passing in an options object.

options

proxy

Type: String
Default: none

CORS proxy to use for local(host). Gets prepended to the request URL.

fetch

Type: Function
Default: none

fetch implementation to use (i.e. in Node.js). By default, the global native implementation will be attempted to be used (i.e. in a modern browser).

user(user)

user

Required
Type: String

Returns the feed for a user.

publication(publication, [tag])

publication

Required
Type: String

tag

Type: String

Returns the feed for a publication with an optional tag.

topic(topic)

topic

Required
Type: String

Returns the feed for a topic.

topics()

Returns the feed of available topics. See also: medium.com/topics.

tag(tag)

tag

Required
Type: String

Returns the feed for a tag.

Feed Formats

RSS (user, publication, topic, or tag) & JSON (topics) feeds are parsed and returned as arrays of objects formatted as follows.

RSS

A user, publication, topic, or tag feed.

{
  date: Date, // ISO date
  link: String, // (URL) link to article
  guid: String, // (URL|URI) GUID
  title: String, // title of article
  author: String, // name of author (_should_ be sans email)
  content: String, // (HTML) content of article
  categories: Array[String] // list of categories
}

JSON

A topics feed.

{
  slug: String, // slug used in link URL
  link: String, // (URL) link to topic
  name: String, // name of topic
  image: String, // (URL) image of topic
  description: String // description of topic
}

Limitations

RSS Item Limits

Medium appears to enforce a 10-item limit per RSS feed with no apparent pagination support.

Contributing

Meed itself along with this documentation is open-source (MIT licensed). Any feature requests, issues, questions, improvements, and so forth can be made in the repository. I don’t bite, I promise.