Skip to content

Instantly share code, notes, and snippets.

@jonallured
Created November 25, 2013 00:06
Show Gist options
  • Save jonallured/7634283 to your computer and use it in GitHub Desktop.
Save jonallured/7634283 to your computer and use it in GitHub Desktop.
Ensure that the `enclosure_url` is curl-able and not escaping the ampersand.
require 'feedzirra'
feed = Feedzirra::Feed.fetch_and_parse('http://www.economist.com/media/rss/economist.xml')
entries = feed.entries
curls = entries.map do |entry|
curl = `curl --head #{entry.enclosure_url}`
curl.split(/\r/).first
end
puts "\n\n\n"
puts curls.uniq
entries.each do |entry|
puts entry.enclosure_url
end
puts "\n\n\n"
puts entries.select { |entry| entry.enclosure_url.match /\&amp\;/ }.count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment