Skip to content

Commit

Permalink
Add support for YouTube playlists. Make the page a little wider.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Oct 8, 2015
1 parent 496aec3 commit 78a487d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app.rb
Expand Up @@ -33,6 +33,8 @@
# https://www.youtube.com/c/khanacademy/videos
elsif /youtube\.com\/.*[\?&]v=(?<video_id>[^&#]+)/ =~ params[:q]
# https://www.youtube.com/watch?v=vVXbgbMp0oY&t=5s
elsif /youtube\.com\/.*[\?&]list=(?<playlist_id>[^&#]+)/ =~ params[:q]
# https://www.youtube.com/playlist?list=PL0QrZvg7QIgpoLdNFnEePRrU-YJfr9Be7
elsif /youtube\.com\/(?<user>[^\/\?#]+)/ =~ params[:q]
# https://www.youtube.com/khanacademy
elsif /youtu\.be\/(?<video_id>[^\?#]+)/ =~ params[:q]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions views/index.erb
Expand Up @@ -29,7 +29,7 @@ a {
}
@media (min-width: 768px) {
.container {
max-width: 730px;
max-width: 770px;
}
}

Expand Down Expand Up @@ -155,7 +155,7 @@ $(document).ready(function() {
<h2>About</h2>

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

Expand Down

0 comments on commit 78a487d

Please sign in to comment.