From f7653309817d9f6be208628e9809d894417570a6 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 18 Oct 2023 11:35:46 +0200 Subject: Youtube: fix youtube links with /live/ in url --- src/plugins/Youtube.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 0c9580f..2959223 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -67,9 +67,9 @@ namespace QuickMedia { return true; } - index = youtube_url.find("youtu.be/"); + index = youtube_url.find("youtube.com/shorts/"); if(index != std::string::npos) { - index += 9; + index += 19; size_t end_index = youtube_url.find("?", index); if(end_index == std::string::npos) end_index = youtube_url.size(); @@ -77,9 +77,19 @@ namespace QuickMedia { return true; } - index = youtube_url.find("youtube.com/shorts/"); + index = youtube_url.find("youtube.com/live/"); if(index != std::string::npos) { - index += 19; + 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; size_t end_index = youtube_url.find("?", index); if(end_index == std::string::npos) end_index = youtube_url.size(); -- cgit v1.2.3