diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-10-18 11:35:46 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-10-18 11:35:46 +0200 |
commit | f7653309817d9f6be208628e9809d894417570a6 (patch) | |
tree | 261a8f85c58150644843d345c4e80dc1f3d61dba /src/plugins | |
parent | 1c611149437194223aeacb2c89dbb8c8cbbf7a57 (diff) |
Youtube: fix youtube links with /live/ in url
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Youtube.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
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(); |