Retrieve posts of a user?
You get the posts of a user by using the RSS feed:
https://medium.com/feed/@user_name
Retrieving a user's or publication posts is not possible using the Medium API v1 (current). Medium staff told me it's deliberately write-only. A few things can be listed, like contributors and publications, but not posts and their content. The RSS feed is to be used in this case.
For example, a popular profile:
https://medium.com/feed/@vanschneider
You can also use it with publications:
https://medium.com/feed/desk-of-van-schneider
Here is an example using Express and the parse-rss NPM module:
var parser = require('parse-rss');
router.get('/blog', function(req, res, next) {
parser('https://medium.com/feed/@vanschneider', function(err, rss)
{
if (err) {
console.log(err);
}
var stories = [];
for (var i = rss.length - 1; i >= 0; i--) {
var new_story = {};
new_story.title = rss[i].title;
new_story.description = rss[i].description;
new_story.date = rss[i].date;
new_story.link = rss[i].link;
new_story.author = rss[i].author;
new_story.comments = rss[i].comments;
stories.push(new_story);
}
console.log('stories:');
console.dir(stories);
res.render('somepage',
{
stories: stories,
});
});
});
It’s not possible to enumerate the list of existing drafts or published posts, e.g. to crosspost to another service or backup your posts to a local archive.
BUT! https://github.com/lambtron/medium-cli you can lookup for solution here :3