From b5dd15aedfbd619e7780b9357c35c429fe5c377c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 7 Aug 2022 22:30:21 +0200 Subject: Youtube: support youtube shorts urls --- TODO | 4 +++- src/plugins/Youtube.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index be98cd6..2b75c1c 100644 --- a/TODO +++ b/TODO @@ -224,4 +224,6 @@ Render watch progress in youtube. Set _NET_WM_USER_TIME (see sfml). Make saucenao work with encrypted images in matrix, or show an error as this is a "security" risk. Body image cache (async image loader) should take requested size into consideration, because the same image can be requested at multiple sizes and we dont want to cache the smaller sized image for both. -To make quickmedia more resilient against broken youtube videos, quickmedia should try other quality if video/audio fails to play. Also do that if the download is stuck/slow for the current quality. \ No newline at end of file +To make quickmedia more resilient against broken youtube videos, quickmedia should try other quality if video/audio fails to play. Also do that if the download is stuck/slow for the current quality. +Make youtube work with age restricted copy righted videos, such as https://www.youtube.com/watch?v=7n3dP_1KqBw. Age restricted videos also play slowly because they have url part that needs to be decoded. +Upload media once in 4chan, on comment enter and then re-use that after solving captcha; instead of reuploading video after each captcha retry. If possible... \ No newline at end of file diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 7552967..a0c15de 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -78,6 +78,16 @@ namespace QuickMedia { return true; } + index = youtube_url.find("youtube.com/shorts/"); + if(index != std::string::npos) { + index += 19; + 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