How to retrieve Medium stories for a user from the API?

前端 未结 11 1424
再見小時候
再見小時候 2021-01-30 04:06

I\'m trying to integrate Medium blogging into an app by showing some cards with posts images and links to the original Medium publication.

From Medium API docs I can see

11条回答
  •  一向
    一向 (楼主)
    2021-01-30 04:49

    Check this One you will get all info about your own post........

    mediumController.getBlogs = (req, res) => {
        parser('https://medium.com/feed/@profileName', 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.json(200, {
                Data: stories
            })
        });
    
    }
    

提交回复
热议问题