diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/DownloadUtils.hpp | 25 | ||||
-rw-r--r-- | include/GoogleCaptcha.hpp | 21 | ||||
-rw-r--r-- | include/StringUtils.hpp | 2 |
3 files changed, 48 insertions, 0 deletions
diff --git a/include/DownloadUtils.hpp b/include/DownloadUtils.hpp new file mode 100644 index 0000000..78fc859 --- /dev/null +++ b/include/DownloadUtils.hpp @@ -0,0 +1,25 @@ +#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 = false); + std::vector<CommandArg> create_command_args_from_form_data(const std::vector<FormData> &form_data); +}
\ No newline at end of file diff --git a/include/GoogleCaptcha.hpp b/include/GoogleCaptcha.hpp new file mode 100644 index 0000000..9c998da --- /dev/null +++ b/include/GoogleCaptcha.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include <string> +#include <optional> +#include <functional> +#include <future> +#include <array> + +namespace QuickMedia { + struct GoogleCaptchaChallengeInfo + { + std::string id; + std::string payload_url; + std::string description; + }; + + using RequestChallengeResponse = std::function<void(std::optional<GoogleCaptchaChallengeInfo>)>; + std::future<bool> google_captcha_request_challenge(const std::string &api_key, const std::string &referer, RequestChallengeResponse challenge_response_callback, bool use_tor = false); + using PostSolutionResponse = std::function<void(std::optional<std::string>, std::optional<GoogleCaptchaChallengeInfo>)>; + std::future<bool> google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array<bool, 9> selected_images, PostSolutionResponse solution_response_callback, bool use_tor); +}
\ No newline at end of file diff --git a/include/StringUtils.hpp b/include/StringUtils.hpp index 72210c9..c6ae244 100644 --- a/include/StringUtils.hpp +++ b/include/StringUtils.hpp @@ -8,4 +8,6 @@ namespace QuickMedia { using StringSplitCallback = std::function<bool(const char *str, size_t size)>; void string_split(const std::string &str, char delimiter, StringSplitCallback callback_func); + void string_replace_all(std::string &str, const std::string &old_str, const std::string &new_str); + std::string strip(const std::string &str); }
\ No newline at end of file |