Changes to nodebb-plugin-rss in light of YQL shutdown



  • Hi Devs,

    YQL service is down for good. See notice here: https://developer.yahoo.com/yql/

    Let's make nodebb-plugin-rss work again!

    Please consider the following changes to the plugin:

    1. In package.json add:
    "rss-parser": "^3.6.2"
    
    1. In index.js: Add on the top:
    var Parser = require('rss-parser');
    
    1. In index.js function pullFeeds: comment out var entry= and change as follows:
    async.eachSeries(entries, function(entryObj, next) {
                            //var entry = entryObj.entry;
                            var entry = {title: entryObj.title, content: {content: entryObj.content}, published: entryObj.pubDate, link: {href: entryObj.link}, id: entryObj.guid, category: entryObj.categories}  ;
    
    1. In index.js function getFeedByYahoo, comment out the entire request section, and replace with:
    let parser = new Parser();
    parser.parseURL(feedUrl, function(err, feed) {
      if(err) callback(err);
      callback(null, feed.items);
    });
    

    Note, I did not take care of entriesToPull, however its trivial to truncate the feed array (I know, I am a bad boy and I should be spanked).

    1. In index.js function checkFeed, comment out var entryData =, and change as follows:
    entries = entries.map(function (entry) {
                            //var entryData = entry.entry || {};
                            var entryData = {title: entry.title, content: {content: entry.content}, published: entry.pubDate, link: {href: entry.link}, id: entry.guid, category: entry.categories}  ;
    

    That's it.
    Note I had to disable "convert to markdown" so the images would display properly.

    Let me know should you have any questions,
    JJ.



  • Why don't you send a PR to the rss plugin? Also why are images not working when convert to markdown is enabled? Is rss-parse not returning img tags?



  • @baris I am not sure about markdown. What I saw is that a weird link was created out of the href and the image was not displayed. I'll debug that soon.



  • Hi @baris,

    As for markdown,

    The following img link:

    <a href="https://path_to_article"><img src="https://path_to_pic.jpg" alt="some_text" title="cool_title" width="some_number" height="another_number" class="img-responsive"></a>
    

    Is converted to:

    <a href="path_to_article" rel="nofollow">![null](link_to_picture "null")</a>
    

    The issue stem from

    toMarkdown = function (input, options) {...}
    

    Fixing toMarkdown is a bit above my paygrade at the moment 😉



  • Will have to look into upgrading it to turndown, https://github.com/barisusakli/nodebb-plugin-rss/issues/41



  • @JJSagan thanks for looking into this, I made the necessary changes to the plugin.


  • GNU/Linux

    Work fine 👌

    Thanks you



  • @baris with pleasure 🙂
    Thank you for considering my comments and revising the plugin!


  • GNU/Linux

    @JJSagan Too Thanks ☺


Log in to reply
 

Suggested Topics

| |