From fde558b220118ff873cc2e735f6ec167ebcf5167 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 9 Aug 2021 19:08:57 +0200 Subject: Use no-buffer curl option for youtube redirect code and matrix streamable video checker --- include/DownloadUtils.hpp | 2 +- src/QuickMedia.cpp | 2 +- src/plugins/Youtube.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/DownloadUtils.hpp b/include/DownloadUtils.hpp index 398f82c..8edcd5a 100644 --- a/include/DownloadUtils.hpp +++ b/include/DownloadUtils.hpp @@ -15,7 +15,7 @@ namespace QuickMedia { struct CommandArg { std::string option; - std::string value; + std::string value; // Optional }; // Return true the return DownloadResult::OK for the download, which also saves the result in cache if |download_to_string_cache| is used diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 1823df8..a21cf11 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -2369,7 +2369,7 @@ namespace QuickMedia { static bool video_url_is_non_streamable_mp4(const char *url) { std::string result; - const char *args[] = { "curl", "-sLf", "-r", "0-40", "-H", useragent_str, "--", url, nullptr }; + const char *args[] = { "curl", "-sLf", "-r", "0-40", "--no-buffer", "-H", useragent_str, "--", url, nullptr }; exec_program(args, accumulate_string_limit_head, &result, 42); return (result.size() >= 42) && (memcmp(&result[4], "ftypisom", 8) == 0 || memcmp(&result[4], "ftypmp42", 8) == 0 || memcmp(&result[4], "ftymp42", 7) == 0 || memcmp(&result[4], "ftyp3gp4", 8) == 0 || memcmp(&result[4], "ftyp3gp5", 8) == 0 || memcmp(&result[4], "fty3gp5", 7) == 0 || memcmp(&result[4], "ftypqt", 6) == 0) diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 5b0591c..a386a70 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -211,6 +211,7 @@ namespace QuickMedia { // TODO: Find why this happens and if there is a way bypass it. static std::string get_playback_url_recursive(std::string playback_url, int64_t &content_length) { std::vector additional_args = get_cookies(); + additional_args.push_back({"--no-buffer", ""}); const int max_redirects = 5; for(int i = 0; i < max_redirects; ++i) { -- cgit v1.2.3