aboutsummaryrefslogtreecommitdiff
path: root/include/DownloadUtils.hpp
blob: 8f26bfc602f9d1202a16fae143706e46037cbbed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include <string>
#include <vector>

namespace QuickMedia {
    enum class DownloadResult {
        OK,
        ERR,
        NET_ERR
    };

    struct CommandArg {
        std::string option;
        std::string value;
    };

    struct FormData {
        std::string key;
        std::string value;
    };

    DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_tor, bool use_browser_useragent = false, bool fail_on_error = true);
    DownloadResult download_to_string_cache(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_tor, bool use_browser_useragent = false);
    std::vector<CommandArg> create_command_args_from_form_data(const std::vector<FormData> &form_data);
}