Skip to content

Instantly share code, notes, and snippets.

@kennethkalmer
Created July 7, 2013 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennethkalmer/5942870 to your computer and use it in GitHub Desktop.
Save kennethkalmer/5942870 to your computer and use it in GitHub Desktop.
Cleaned up my feedly subs using this, no point of having feeds that clutter up the list, yet they 404 or 500
# 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