-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample.Textcaptcha.cpp
More file actions
30 lines (26 loc) Β· 961 Bytes
/
example.Textcaptcha.cpp
File metadata and controls
30 lines (26 loc) Β· 961 Bytes
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
27
28
29
30
// example.Textcaptcha.cpp β type 11: Text CAPTCHA (question/answer)
#include <iostream>
#include "deathbycaptcha/deathbycaptcha.hpp"
int main() {
const std::string username = "your_username";
const std::string password = "your_password";
dbc::HttpClient client(username, password);
try {
std::cout << "Balance: " << client.get_balance() << '\n';
dbc::Params params = {
{"type", "11"},
{"textcaptcha", "What is the sum of 2 + 3?"}
};
auto result = client.decode(std::nullopt, 60, params);
if (result) {
std::cout << "CAPTCHA " << result->captcha
<< " solved: " << result->text.value_or("") << '\n';
} else {
std::cout << "Failed to solve (timeout)\n";
}
} catch (const dbc::AccessDeniedException& e) {
std::cerr << "Access denied: " << e.what() << '\n';
return 1;
}
return 0;
}