diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-02-27 19:27:33 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-02-27 19:27:33 +0100 |
commit | 87ed9cb8c09aa61f6e3d4e8246195162ef176468 (patch) | |
tree | cbb3c405e622909709afdcbb51f8798b18f71f9e /src/plugins | |
parent | fab3bb7f8af92b47ce2e7be7c5b58c4ea5aee48c (diff) |
youtube: fix youtu.be/watch?v= urls
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Youtube.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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; |