aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-11-28 11:22:42 +0100
committerdec05eba <dec05eba@protonmail.com>2023-11-28 11:22:42 +0100
commita1f6e3901be223b3ce771b6d2f91de37ef9fd81c (patch)
treedb9b9063899a1b075e1cebd04ee61be06e8eb2ca /src
parente90a00764642f79ad61cef8659ce6147299a26d8 (diff)
Assume watch?v= is a youtube url
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Youtube.cpp15
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;
}