lib/imasquerade/extractor.rb in imasquerade-0.1.2 vs lib/imasquerade/extractor.rb in imasquerade-0.1.3
- old
+ new
@@ -14,20 +14,22 @@
return id
end
def Extractor.fetch_and_parse_feed_from_apple(id)
uri = "http://itunes.apple.com/podcast/id#{id}"
- response = Curl::Easy.perform(uri) do |curl|
- curl.headers["User-Agent"] = 'iTunes/10.1.1'
- end
# In case there is some sort of error
begin
+ response = Curl::Easy.perform(uri) do |curl|
+ curl.headers["User-Agent"] = 'iTunes/10.1.1'
+ end
reader = Nokogiri::XML(response.body_str)
array_of_feeds = reader.xpath('//xmlns:key[text()="feedURL"]/following-sibling::xmlns:string[1]/text()')
return array_of_feeds[0].to_s
rescue Nokogiri::XML::SyntaxError => e
puts "Caught exception: #{e}"
return ""
+ rescue Curl::Err::HostResolutionError => e
+ puts "Caught exception: #{e}"
end
end
end
end
\ No newline at end of file