aboutsummaryrefslogtreecommitdiff
path: root/src/DownloadUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/DownloadUtils.cpp')
-rw-r--r--src/DownloadUtils.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp
index 129234f..8193c90 100644
--- a/src/DownloadUtils.cpp
+++ b/src/DownloadUtils.cpp
@@ -4,6 +4,8 @@
#include <SFML/System/Clock.hpp>
#include <cppcodec/base64_rfc4648.hpp>
+static const bool debug_download = false;
+
static int accumulate_string(char *data, int size, void *userdata) {
std::string *str = (std::string*)userdata;
str->append(data, size);
@@ -31,6 +33,13 @@ namespace QuickMedia {
args.push_back("--");
args.push_back(url.c_str());
args.push_back(nullptr);
+ if(debug_download) {
+ for(const char *arg : args) {
+ if(arg)
+ fprintf(stderr, "%s ", arg);
+ }
+ fprintf(stderr, "\n");
+ }
if(exec_program(args.data(), accumulate_string, &result) != 0)
return DownloadResult::NET_ERR;
fprintf(stderr, "Download duration for %s: %d ms\n", url.c_str(), timer.getElapsedTime().asMilliseconds());
@@ -49,7 +58,7 @@ namespace QuickMedia {
return DownloadResult::ERR;
}
} else {
- DownloadResult download_result = download_to_string(url, result, additional_args, use_tor);
+ DownloadResult download_result = download_to_string(url, result, additional_args, use_tor, use_browser_useragent);
if(download_result == DownloadResult::OK) {
if(create_directory_recursive(media_dir) == 0 && file_overwrite(media_file_path, result) == 0) {
create_lock_file(media_finished_path);