Skip to content

Commit

Permalink
Catch bad YouTube URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Apr 6, 2021
1 parent f4839db commit f4894ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app.rb
Expand Up @@ -313,7 +313,7 @@
next "Error: Could not find the user. Please try with a video url instead." if response.code == 404
raise(App::GoogleError, response) if !response.success?
doc = Nokogiri::HTML(response.body)
doc.at("meta[itemprop='channelId']")["content"]
doc.at("meta[itemprop='channelId']")["content"] || "Error: Could not find the user. Please try with a video url instead."
end
elsif video_id
channel_id, _ = App::Cache.cache("youtube.video", video_id, 60*60, 60) do
Expand Down

0 comments on commit f4894ac

Please sign in to comment.