Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nachum37/fc3c8e86427d036f478bd2032b51326c to your computer and use it in GitHub Desktop.
Save nachum37/fc3c8e86427d036f478bd2032b51326c to your computer and use it in GitHub Desktop.
Simple script to export Feedly Read Later and Import to Pocket

Export Feedly Read Later to Pocket

Simple Google Chrome's Dev-Tools Console script that exports a users Read Later list out of Feedly as a JSON string, and instroctions how to import the file to Pocket.

Based on bradcrawford's script, with a fixed filesaver.js source, JSON time attribute & JSON MIME Type. The Pocket import instructions are based on xtheshadowgod's Stack Overflow answer.

Format of JSON is as follows:

[
  {
  "name":"Title",  
  "url":"http://www.example.com/title",  
  "created":"ISO-8601 formatted time and timezone",
  "modified":"ISO-8601 formatted time and timezone",
  "image":"https://lh3.googleusercontent.com/urlToImage"
  }  
]  

How to use:

  1. Open up your browser.
  2. Login to Feedly and go to the "Read Later" board.
  3. Keep scrolling down the page until all saved documents have been loaded. If you got some errors, try to disable all browser addons.
  4. Right click on the page and select "Inspect Element".
  5. Inside the "Inspector" tool, click the "Console" tab.
  6. Copy the code below and paste into the console. A JSON file should be downloaded.
  7. Go to https://getpocket.com/import/springpad and import the downloaded JSON file.
// Feedly doesn't use jQuery so firstly inject it into the page
function loadJQuery() {
    script = document.createElement('script');
    script.setAttribute('src', '//code.jquery.com/jquery-3.5.1.slim.min.js');
    script.setAttribute('type', 'text/javascript');
    script.onload = loadSaveAs;
    document.getElementsByTagName('head')[0].appendChild(script);
}

function loadSaveAs() {
    saveAsScript = document.createElement('script');
    saveAsScript.setAttribute('src', '//cdn.jsdelivr.net/g/filesaver.js');
    saveAsScript.setAttribute('type', 'text/javascript');
    saveAsScript.onload = saveToFile;
    document.getElementsByTagName('head')[0].appendChild(saveAsScript);
}

function saveToFile() {
    // Loop through the DOM, grabbing the information from each bookmark
    map = jQuery(".entry.quicklisted").map(function (i, el) {
        var $el = jQuery(el);
        var time = $el.find("span.ago").attr("title").split("\n");
        return {
            "name":$el.attr("data-title"),
            "url":$el.attr("data-alternate-link"),
            "created": new Date(time[1].split("Received: ")[1]).toISOString(), 
            "modified": new Date(time[0].split("Published: ")[1]).toISOString(),
            "image":$el.find("div.visual").css('background-image').split(/"/)[1]
        };
    }).get(); // Convert jQuery object into an array

    // Convert to a nicely indented JSON string
    json = JSON.stringify(map, undefined, 2);
    var blob = new Blob([json], { type: "application/json;charset=utf-8" });
    // Downloads as a file to the desktop, and use Feedly user's email in the filename.
    saveAs(blob, `FeedlyReadLater_${streets.getEmail()}_${Date.now().toString()}.json`);
}

loadJQuery()

Unsave all Read Later items

After scrolling to the end of the list and load JQuery as above, If you want to remove all entries from the Read Later list;

  1. Double-check that you backed up all the entries properly!
  2. Copy the code below and paste into the console.
jQuery.each(jQuery('.save-for-later.saved'), function (index, el) { jQuery(el).click() })

Based on Peter Valdemar Mørch answer on Quora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment