From 6c7adadf6d5c85d5e280e965d4dee1563bf46821 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 1 Dec 2019 18:05:16 +0100 Subject: Add 4chan posting --- include/DownloadUtils.hpp | 25 +++++++++++++++++++++++++ include/GoogleCaptcha.hpp | 21 +++++++++++++++++++++ include/StringUtils.hpp | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 include/DownloadUtils.hpp create mode 100644 include/GoogleCaptcha.hpp (limited to 'include') 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 +#include + +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 &additional_args = {}, bool use_tor = false); + std::vector create_command_args_from_form_data(const std::vector &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 +#include +#include +#include +#include + +namespace QuickMedia { + struct GoogleCaptchaChallengeInfo + { + std::string id; + std::string payload_url; + std::string description; + }; + + using RequestChallengeResponse = std::function)>; + std::future 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, std::optional)>; + std::future google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array 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; 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 -- cgit v1.2.3-70-g09d2