From 170fd4dcf734034cfe99126773aeccce3769d920 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Sun, 8 Oct 2017 17:46:20 -0700 Subject: [PATCH] Add iTunes podcast feed support to /go. --- app.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.rb b/app.rb index e3a150e..7d727f6 100644 --- a/app.rb +++ b/app.rb @@ -56,6 +56,11 @@ redirect "/imgur?#{params.to_querystring}" elsif /^https?:\/\/(?[a-zA-Z0-9\-]+)\.deviantart\.com/ =~ params[:q] redirect "https://backend.deviantart.com/rss.xml?type=deviation&q=by%3A#{user}+sort%3Atime" + elsif /^https?:\/\/itunes\.apple\.com\/.+\/id(?\d+)/ =~ params[:q] + # https://itunes.apple.com/us/podcast/the-bernie-sanders-show/id1223800705 + response = HTTP.get("https://itunes.apple.com/lookup?id=#{id}") + raise(HTTPError, response) if !response.success? + redirect response.json["results"][0]["feedUrl"] elsif /^https?:\/\/(?:www\.)?svtplay\.se/ =~ params[:q] redirect "/svtplay?#{params.to_querystring}" else