-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathTemuExample.cs
More file actions
43 lines (36 loc) · 1.34 KB
/
TemuExample.cs
File metadata and controls
43 lines (36 loc) · 1.34 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.IO;
using System.Linq;
using TwoCaptcha.Captcha;
namespace TwoCaptcha.Examples
{
public class TemuExample
{
public TemuExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha(apiKey);
byte[] bodyBytes = File.ReadAllBytes("resources/temu/body.png");
string bodyStr = Convert.ToBase64String(bodyBytes);
byte[] part1Bytes = File.ReadAllBytes("resources/temu/part1.png");
string part1Str = Convert.ToBase64String(part1Bytes);
byte[] part2Bytes = File.ReadAllBytes("resources/temu/part2.png");
string part2Str = Convert.ToBase64String(part2Bytes);
byte[] part3Bytes = File.ReadAllBytes("resources/temu/part3.png");
string part3Str = Convert.ToBase64String(part3Bytes);
Temu captcha = new Temu();
captcha.SetBody(bodyStr);
captcha.SetPart1(part1Str);
captcha.SetPart2(part2Str);
captcha.SetPart3(part3Str);
try
{
solver.Solve(captcha).Wait();
Console.WriteLine("Captcha solved: " + captcha.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}