diff options
-rw-r--r-- | src/DownloadUtils.cpp | 10 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp index a4557d2..8685662 100644 --- a/src/DownloadUtils.cpp +++ b/src/DownloadUtils.cpp @@ -199,16 +199,24 @@ namespace QuickMedia { std::vector<const char*> args; if(cloudflare_bypass) { - args.insert(args.end(), { "wget", "--header", "Accept-Language: en-US,en;q=0.5", "-q", "-O", "-" }); + args.insert(args.end(), { "wget", "--header", "Accept-Language: en-US,en;q=0.5", "-q" }); // TODO: //if(fail_on_error) // args.push_back("-f"); // TODO: May not be compatible + bool additional_args_has_output_file = false; for(const CommandArg &arg : additional_args) { args.push_back(arg.option.c_str()); if(!arg.value.empty()) args.push_back(arg.value.c_str()); + + if(arg.option == "-o") + additional_args_has_output_file = true; } + + if(!additional_args_has_output_file) + args.insert(args.end(), { "-O", "-" }); + if(use_browser_useragent) { args.push_back("--header"); args.push_back(useragent_str); diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 101fa59..45c0bd1 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3846,7 +3846,6 @@ namespace QuickMedia { std::vector<CommandArg> extra_args; const bool is_manganelo = (strcmp(images_page->get_service_name(), "manganelo") == 0); const char *website_url = images_page->get_website_url(); - const bool cloudflare_bypass = (strcmp(images_page->get_service_name(), "manganelo") == 0 || strcmp(images_page->get_service_name(), "readm") == 0); if(is_manganelo) { extra_args = { CommandArg { "-H", "accept: image/jpeg,image/png,image/*,*/*;q=0.8" }, @@ -3876,7 +3875,7 @@ namespace QuickMedia { } } else { int64_t file_size = 0; - if(download_to_file(url, image_filepath_tmp.data, extra_args, true, cloudflare_bypass) != DownloadResult::OK || (is_manganelo && file_get_size(image_filepath_tmp, &file_size) == 0 && file_size < 255)) { + if(download_to_file(url, image_filepath_tmp.data, extra_args, true) != DownloadResult::OK || (is_manganelo && file_get_size(image_filepath_tmp, &file_size) == 0 && file_size < 255)) { if(!image_download_cancel) show_notification("QuickMedia", "Failed to download image: " + url, Urgency::CRITICAL); return true; } |