diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/Youtube.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
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<std::string, 10> invidious_urls = { + static const std::array<std::string, 11> 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; } |