Skip to content

Commit

Permalink
youtube video ids often have dashes
Browse files Browse the repository at this point in the history
Signed-off-by: Robb Kidd <robb@thekidds.org>
  • Loading branch information
robbkidd committed Jul 21, 2020
1 parent 1a14110 commit d654b86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/youtube.rb
Expand Up @@ -21,7 +21,7 @@ def on_message(message, matches)

url = "https://www.youtube.com/results?search_query=#{searchterm}"
body = HTTParty.get(url, {ssl_ca_file: Certifi.where})
watch_link_scan = body.to_s.scan(%r{watch\?v=\w*})
watch_link_scan = body.to_s.scan(%r{watch\?v=[\w-]*})
if watch = watch_link_scan[0]
"https://www.youtube.com/#{watch}"
else
Expand Down

0 comments on commit d654b86

Please sign in to comment.