From a1f6e3901be223b3ce771b6d2f91de37ef9fd81c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 28 Nov 2023 11:22:42 +0100 Subject: Assume watch?v= is a youtube url --- src/plugins/Youtube.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 2e3a238..683845b 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -21,7 +21,7 @@ extern "C" { namespace QuickMedia { static const char *youtube_client_version = "x-youtube-client-version: 2.20210622.10.00"; - static const std::array invidious_urls = { + static const std::array invidious_urls = { "yewtu.be", "invidious.snopyta.org", "invidious.kavin.rocks", @@ -31,7 +31,8 @@ namespace QuickMedia { "invidious.silkky.cloud", "invidious-us.kavin.rocks", "inv.riverside.rocks", - "y.com.cm" + "y.com.cm", + "invidious.io.lol" }; std::string invidious_url_to_youtube_url(const std::string &url) { @@ -97,6 +98,16 @@ namespace QuickMedia { return true; } + index = youtube_url.find("watch?v="); + if(index != std::string::npos) { + index += 8; + 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; + } + return false; } -- cgit v1.2.3