Sha256: 812e9eb90b783767189f6d3fe7debbc1a1c4c464c86814f8190b0307e3f1191e
Contents?: true
Size: 518 Bytes
Versions: 1
Compression:
Stored size: 518 Bytes
Contents
module Imasquerade @itunes_id_regex = /(?:id=?)(?<id>[0-9]+)/i def self.parse_itunes_uri(uri) # Extract the iTunes id from the URI id = uri.match(@itunes_id_regex)[:id] # Get raw JSON search response = HTTParty.get('https://itunes.apple.com/lookup', {query: {id: id}}) # Parse the JSON to a Hash hash = MultiJson.load(response.body, symbolize_keys: true) # Extract the first feed URL hash[:results].first[:feedUrl] if hash.has_key?(:results) && hash[:resultCount] > 0 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
imasquerade-0.3.0 | lib/imasquerade/extractor.rb |