From 87ed9cb8c09aa61f6e3d4e8246195162ef176468 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 27 Feb 2022 19:27:33 +0100 Subject: youtube: fix youtu.be/watch?v= urls --- src/plugins/Youtube.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index e0d79c3..d80d86c 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -55,6 +55,16 @@ namespace QuickMedia { return true; } + index = youtube_url.find("youtu.be/watch?v="); + if(index != std::string::npos) { + index += 17; + size_t end_index = youtube_url.find("&", index); + if(end_index == std::string::npos) + end_index = youtube_url.size(); + youtube_video_id = youtube_url.substr(index, end_index - index); + return true; + } + index = youtube_url.find("youtu.be/"); if(index != std::string::npos) { index += 9; -- cgit v1.2.3