Created
July 7, 2013 09:09
Cleaned up my feedly subs using this, no point of having feeds that clutter up the list, yet they 404 or 500
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic check of feeds urls in an OPML file | |
require 'nokogiri' | |
require 'faraday' | |
def say( text ) | |
$stdout.write text | |
$stdout.flush | |
end | |
doc = Nokogiri( File.read('feedly.opml') ) | |
doc.xpath('//outline[@xmlurl]').each do |outline| | |
name = outline['text'] | |
url = outline['xmlurl'] | |
begin | |
say "Checking #{name}: " | |
response = Faraday.get( url ) | |
case response.status | |
when 200..299 | |
say "OK\n" | |
when 301, 302 | |
say "New location at #{response.headers['Location']}\n" | |
else | |
say "Responded with #{response.status}\n" | |
end | |
rescue => e | |
say "Failed to get #{url}\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment