-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathVkCaptchaExample.java
More file actions
33 lines (26 loc) · 1.13 KB
/
VkCaptchaExample.java
File metadata and controls
33 lines (26 loc) · 1.13 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
package examples;
import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.VkCaptcha;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;
public class VkCaptchaExample {
private void tokenBased(String apiKey) throws IOException {
TwoCaptcha solver = new TwoCaptcha(apiKey);
VkCaptcha captcha = new VkCaptcha("vkcaptcha");
captcha.setRedirectUri("https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1");
captcha.setuserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36");
captcha.setProxy("http", "1.2.3.4");
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}
public static void main(String[] args) throws Exception {
VkCaptchaExample vkExample = new VkCaptchaExample();
vkExample.tokenBased(args[0]);
}
}