-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathKissAnime Auto Captcha.user.js
140 lines (128 loc) · 4.15 KB
/
KissAnime Auto Captcha.user.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// ==UserScript==
// @name KissAnime Auto Captcha V3.2
// @namespace https://greasyfork.org/en/users/135934-elti-musa
// @version 3.2.1
// @description Auto complete KissAnime Captcha
// @author AnimeBro1
// @match http://kissanime.ru/Special/AreYouHuman2*
// @grant GM_setValue
// @run-at document-end
// @grant GM_getValue
// @grant GM_listValues
// @grant GM_deleteValue
// @grant GM_xmlhttpRequest
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// ==/UserScript==
var words = [];
var imagesURL;
var count = 0;
var images = ["","","",""];
var imagecount = 0;
var imageURLcount = 0;
var w;
(function() {
$("body").append('<div id="CaptchaInfo" style="z-index: 99999999; display:none;width:200px;height:150px;font-size:14px;position:fixed; top: 10px; left:10px; background: #14dd3edb; border-radius: 25px;padding:40px;"><p></p></div>');
if(!isBasicJson()){
alert("FIRST TIME RUNNING: Make sure you REMOVE previous version of the script.");
factoryReset();
getBasicJson();
}else{
words = getWords();
imagesURL = $("[indexValue]").toArray();
toDataURL(imagesURL[0].src,function(data){DONE(data);});
}
})();
function DONE(a){
//alert(imageURLcount);
imageURLcount++;
images[imagecount] = cutImage64(cutImage64(a,3),2);
if(imagecount == 3){
console.log(images);
Complete();
}else{
toDataURL(imagesURL[imageURLcount].src,function(data){DONE(data);});
imagecount++;
}
}
function getWords(){
var words = $("#formVerify").find("span").toArray();
var First = words[0].innerText;
var Second = words[1].innerText;
return [First, Second];
}
function cutImage64(base64,s){
var a = "";
for(var i = 0; i < base64.length; i=i+s){
a += base64.charAt(i);
}
return a;
}
function toDataURL(url, callback) {
var xhr = new XMLHttpRequest();
xhr.onload = function() {
var reader = new FileReader();
reader.onloadend = function() {
callback(reader.result);
};
reader.readAsDataURL(xhr.response);
};
//alert("http://kissanime.ru/Special/"+url);
xhr.open('GET', url);
xhr.responseType = 'blob';
xhr.send();
}
function getBasicJson(){
$("#CaptchaInfo").show();
$("#CaptchaInfo").find("p").html("First time running, fetching some files... Page will reload.");
var msg='';
//msg = $.ajax({type: "GET", url: "https://cdn.rawgit.com/Eltion/Kissanime-Chaptcha-Auto-Complete/111255eebd4ee25aaa2ad6d072b75ae446217d97/KissAnime.Downloader.Chaptcha.Database.json", async: false}).responseText;
GM_xmlhttpRequest({
method: "GET",
url: "https://cdn.rawgit.com/Eltion/Kissanime-Chaptcha-Auto-Complete/eee0c4153d22cec5a5327efc8d7d8ba3b37394d9/KissAnime.Downloader.Chaptcha.Database2.json",
synchronous: true,
onload: function(response) {
msg = response.responseText;
msg = JSON.parse(msg);
for(var i = 0; i < msg.length; i++){
GM_setValue(msg[i].n,msg[i].v);
}
location.reload();
}
});
}
function isBasicJson(){
return GM_getValue("AnimeBro3",false);
}
function factoryReset(){
var keys = GM_listValues();
for (var i=0; i < keys.length; i++) {
GM_deleteValue(keys[i]);
}
}
function Complete() {
var jj = 0;
console.log(images);
for(var j = 0; j <2; j++){
var w1 = GM_getValue(words[j], false);
if(w1 !== false){
if(w1.includes(" ")){
w1 = w1.split(" ");
}else{
w1 = [w1];
}
for(var k =0; k < w1.length; k++){
for(var i = 0; i < images.length; i++){
if(images[i] === w1[k]){
$("[indexValue='"+i+"']").click();
jj++;
}
}
}
}
}
if(jj < 2){
location.reload();
}
//UpdateTest(jj);
//Learn();
}