aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-10-18 11:35:46 +0200
committerdec05eba <dec05eba@protonmail.com>2023-10-18 11:35:46 +0200
commitf7653309817d9f6be208628e9809d894417570a6 (patch)
tree261a8f85c58150644843d345c4e80dc1f3d61dba
parent1c611149437194223aeacb2c89dbb8c8cbbf7a57 (diff)
Youtube: fix youtube links with /live/ in url
-rw-r--r--TODO4
-rw-r--r--src/plugins/Youtube.cpp18
2 files changed, 17 insertions, 5 deletions
diff --git a/TODO b/TODO
index 0950061..d160342 100644
--- a/TODO
+++ b/TODO
@@ -287,4 +287,6 @@ Add option to get notified on any matrix event type (maybe have a config list wi
we could know when somebody calls us.
Also mark such room the same way as a mention - it should be put at the top of the room list.
Add command to ignore/hide a room (should also not get notified when you are mentioned in the room).
-Improve youtube live streaming performance. It's slow because mpv (ffmpeg) is slow at playing m3u8. \ No newline at end of file
+Improve youtube live streaming performance. It's slow because mpv (ffmpeg) is slow at playing m3u8.
+Add youtube config for allowing to specify download specific codec preference (or ignore video max height). Might have slow download so cant play high quality video but after downloading it it can be played.
+Fix youtube age restricted videos. \ No newline at end of file
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();