Skip to content

Commit

Permalink
Move channel_id regex to last, it matches a bit too much.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Apr 14, 2018
1 parent 327f6f5 commit 034b64b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@
if /youtube\.com\/channel\/(?<channel_id>(UC|S)[^\/?#]+)/ =~ params[:q]
# https://www.youtube.com/channel/UC4a-Gbdw7vOaccHmFo40b9g/videos
# https://www.youtube.com/channel/SWu5RTwuNMv6U
elsif /\b(?<channel_id>(?:UC[^\/?#]{22,}|S[^\/?#]{12,}))/ =~ params[:q]
# it's a channel id
elsif /youtube\.com\/(?<type>user|c|show)\/(?<slug>[^\/?#]+)/ =~ params[:q]
# https://www.youtube.com/user/khanacademy/videos
# https://www.youtube.com/c/khanacademy
Expand All @@ -149,6 +147,8 @@
# https://www.youtube.com/khanacademy
elsif /youtu\.be\/(?<video_id>[^?#]+)/ =~ params[:q]
# https://youtu.be/vVXbgbMp0oY?t=1s
elsif /\b(?<channel_id>(?:UC[^\/?#]{22,}|S[^\/?#]{12,}))/ =~ params[:q]
# it's a channel id
else
# it's probably a channel name
user = params[:q]
Expand Down

0 comments on commit 034b64b

Please sign in to comment.