aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-09 19:08:57 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-09 19:08:57 +0200
commitfde558b220118ff873cc2e735f6ec167ebcf5167 (patch)
tree5c17d9dd94533e512f864b3bf8c983501a1b1364
parent27a79a205f865a4023d8e78d0699cc12f2f707cf (diff)
Use no-buffer curl option for youtube redirect code and matrix streamable video checker
-rw-r--r--include/DownloadUtils.hpp2
-rw-r--r--src/QuickMedia.cpp2
-rw-r--r--src/plugins/Youtube.cpp1
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<CommandArg> additional_args = get_cookies();
+ additional_args.push_back({"--no-buffer", ""});
const int max_redirects = 5;
for(int i = 0; i < max_redirects; ++i) {