Using text-only NPR

The text-only version of NPR is a great website to get news from, but it suffers from two flaws:

  1. There is no easy way to get from a regular NPR link to its corresponding text-only version.
  2. The NPR links in a text-only version point to regular versions.

To remedy this, I created two bookmarklets:

  1. Go to text-only NPR version - use when you're on a regular NPR page and want to go to its text-only version.
    var href = location.href;
    href = href.split('/');
    if (href.length === 8 && href[2] === "www.npr.org") {
        location.href = "https://text.npr.org/s.php?sId=" + href[6];
    }
    
    
  2. Fix text-only NPR links - use on a text-only NPR page to convert regular NPR links to text-only links.
    var links = document.links;
    var href;
    for(var i = 0; i < links.length; i++)
    {
        href = links[i].href.split('/');
        if (href.length === 8 && href[2] === "www.npr.org") {
            links[i].href = "https://text.npr.org/s.php?sId=" + href[6];
            links[i].title = "NPR: " + href[7].replace(/[-]/g, " ")
        }
    }
    
    

Last modified on 12 Mar 2019 at 07:35:46 PM EDT ET