├── README.md ├── package.json ├── LICENSE └── check.js /README.md: -------------------------------------------------------------------------------- 1 | # checkFeedsInOpml 2 | A utility that checks if the feeds in an OPML list are accessible 3 | 4 | See this [blog post](http://scripting.com/2017/02/12/theGuardiansFeeds.html) for an explanation. 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "checkFeedsInOpml", 3 | "description": "Read all the feeds in the OPML file, report on success.", 4 | "author": "Dave Winer ", 5 | "version": "0.4.1", 6 | "dependencies" : { 7 | "request": "*", 8 | "opmlparser": "*" 9 | }, 10 | "license": "MIT", 11 | "engines": { 12 | "node": "0.10.*" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Dave Winer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /check.js: -------------------------------------------------------------------------------- 1 | var request = require ("request"); 2 | var opmlParser = require ("opmlparser"); 3 | var urlOpmlFile = "http://rss2.io/lists/guardian.opml"; 4 | 5 | function readOpmlFile (url, callback) { 6 | var req = request (url); 7 | var opmlparser = new opmlParser (); 8 | req.on ("response", function (res) { 9 | var stream = this; 10 | if (res.statusCode == 200) { 11 | stream.pipe (opmlparser); 12 | } 13 | }); 14 | req.on ("error", function (res) { 15 | }); 16 | opmlparser.on ("error", function (error) { 17 | console.log ("readIncludedList: opml parser error == " + error.message); 18 | }); 19 | opmlparser.on ("readable", function () { 20 | var outline; 21 | while (outline = this.read ()) { 22 | var type = outline ["#type"]; 23 | if (type == "feed") { 24 | if ((outline.xmlurl != undefined) && (outline.xmlurl.length > 0)) { 25 | callback (outline); 26 | } 27 | } 28 | } 29 | }); 30 | opmlparser.on ("end", function () { 31 | }); 32 | } 33 | 34 | readOpmlFile (urlOpmlFile, function (jstruct) { 35 | request (jstruct.xmlurl, function (err, response, body) { 36 | if (err) { 37 | console.log (jstruct.text + ": err.message == " + err.message); 38 | } 39 | else { 40 | console.log (jstruct.text + ": " + response.statusCode); 41 | } 42 | }); 43 | }); 44 | --------------------------------------------------------------------------------