Skip to content

Commit

Permalink
Add iTunes podcast feed support to /go.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Oct 9, 2017
1 parent e03d9e1 commit 170fd4d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app.rb
Expand Up @@ -56,6 +56,11 @@
redirect "/imgur?#{params.to_querystring}"
elsif /^https?:\/\/(?<user>[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(?<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
Expand Down

0 comments on commit 170fd4d

Please sign in to comment.