From 78a487deaa54b233a72b712c558cb7acaab0af47 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Wed, 7 Oct 2015 23:05:09 -0700 Subject: [PATCH] Add support for YouTube playlists. Make the page a little wider. --- app.rb | 4 ++++ views/index.erb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app.rb b/app.rb index 08aa1d2..d41646e 100644 --- a/app.rb +++ b/app.rb @@ -33,6 +33,8 @@ # https://www.youtube.com/c/khanacademy/videos elsif /youtube\.com\/.*[\?&]v=(?[^&#]+)/ =~ params[:q] # https://www.youtube.com/watch?v=vVXbgbMp0oY&t=5s + elsif /youtube\.com\/.*[\?&]list=(?[^&#]+)/ =~ params[:q] + # https://www.youtube.com/playlist?list=PL0QrZvg7QIgpoLdNFnEePRrU-YJfr9Be7 elsif /youtube\.com\/(?[^\/\?#]+)/ =~ params[:q] # https://www.youtube.com/khanacademy elsif /youtu\.be\/(?[^\?#]+)/ =~ params[:q] @@ -64,6 +66,8 @@ if channel_id redirect "https://www.youtube.com/feeds/videos.xml?channel_id=#{channel_id}" + elsif playlist_id + redirect "https://www.youtube.com/feeds/videos.xml?playlist_id=#{playlist_id}" else "Could not find the channel. Sorry." end diff --git a/views/index.erb b/views/index.erb index c3905d9..ca35778 100644 --- a/views/index.erb +++ b/views/index.erb @@ -29,7 +29,7 @@ a { } @media (min-width: 768px) { .container { - max-width: 730px; + max-width: 770px; } } @@ -155,7 +155,7 @@ $(document).ready(function() {

About

    -
  • YouTube lets you subscribe to a channel's recent videos, but it is difficult to find the url.
  • +
  • YouTube lets you subscribe to a channel's recent videos, but it is difficult to find the url. Playlists also work.
  • The other platforms don't have native feeds, so this website builds a feed from their API.