Created
November 25, 2013 00:06
-
-
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.
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
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 /\&\;/ }.count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment