Greasy Fork is available in English.
Saves initial responses to KissAnime captcha and auto-selects images if it knows the answer. Updated for the new six image captcha.
当前为
// ==UserScript==
// @name [KissAnime] Captcha Solver
// @namespace http://greasyfork.icu/en/users/193865-westleym
// @author WestleyM
// @version 2018.06.30
// @icon http://kissanime.ru/Content/images/favicon.ico
// @description Saves initial responses to KissAnime captcha and auto-selects images if it knows the answer. Updated for the new six image captcha.
// @grant none
// @include http://kissanime.ru/Special/AreYouHuman2*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
/*
Author Notes:
This is a fork of a script made by user ankit16-19. The original script can be found here: http://greasyfork.icu/en/scripts/368595-kissanime-anime-captcha-solver
The purpose of this version is to allow support for the new captcha, with 6 images rather than the old 4. It should be noted that
the initial solving of the captcha will take quite a long time due to the addition of numbers in the images. My estimate is about 100 episodes.
Also take note of the fact that occasionally you may have a captcha with 8 images. Either refresh the page or manually solve the captcha.
Support for any number of images will be added at a later date. As of now, this script is only a light modification of its parent script.
In the future I may also include the captcha solutions in the code, I still haven't decided since it will take up a large chunk of the file.
Commenting of this code is sparse but I will improve it later.
If ankit16-19 would like this removed I will delete it.
*/
//Custom HTML
$("#formVerify").append("<br>")
//First Button
var input=document.createElement("input");
input.id = "image1"
input.type="button";
input.value="Image1";
input.onclick = function(){
if(!localStorage.getItem("helpword")){
localStorage.setItem(localStorage.getItem("helpWord"),ProcessImages()[0])
localStorage.removeItem("helpword");
}
if(unknownwords[2] !== undefined && count < 1){
askForHelp(unknownwords[2]);
count++;
}
$("[indexValue=0]").click();
}
input.setAttribute("style", "font-size:18px;");
document.getElementById("formVerify").appendChild(input);
//Second Button
var input=document.createElement("input");
input.id = "image2"
input.type="button";
input.value="Image2";
input.onclick = function(){
if(!localStorage.getItem("helpword")){
localStorage.setItem(localStorage.getItem("helpWord"),ProcessImages()[1])
localStorage.removeItem("helpword");
}
if(unknownwords[2] !== undefined && count < 1){
askForHelp(unknownwords[2]);
count++;
}
$("[indexValue=1]").click();
}
input.setAttribute("style", "font-size:18px;");
document.getElementById("formVerify").appendChild(input);
//Third Button
var input=document.createElement("input");
input.id = "image3"
input.type="button";
input.value="Image3";
input.onclick = function(){
if(!localStorage.getItem("helpword")){
localStorage.setItem(localStorage.getItem("helpWord"),ProcessImages()[2])
localStorage.removeItem("helpword");
}
if(unknownwords[2] !== undefined && count < 1){
askForHelp(unknownwords[2]);
count++;
}
$("[indexValue=2]").click();
}
input.setAttribute("style", "font-size:18px;");
document.getElementById("formVerify").appendChild(input);
//Fourth Button
var input=document.createElement("input");
input.id = "image4"
input.type="button";
input.value="Image4";
input.onclick = function(){
if(!localStorage.getItem("helpword")){
localStorage.setItem(localStorage.getItem("helpWord"),ProcessImages()[3])
localStorage.removeItem("helpword");
}
if(unknownwords[2] !== undefined && count < 1){
askForHelp(unknownwords[2]);
count++;
}
$("[indexValue=3]").click();
}
input.setAttribute("style", "font-size:18px;");
document.getElementById("formVerify").appendChild(input);
//Fifth Button
var input=document.createElement("input");
input.id = "image5"
input.type="button";
input.value="Image5";
input.onclick = function(){
if(!localStorage.getItem("helpword")){
localStorage.setItem(localStorage.getItem("helpWord"),ProcessImages()[4])
localStorage.removeItem("helpword");
}
if(unknownwords[2] !== undefined && count < 1){
askForHelp(unknownwords[2]);
count++;
}
$("[indexValue=4]").click();
}
input.setAttribute("style", "font-size:18px;");
document.getElementById("formVerify").appendChild(input);
//Sixth Button
var input=document.createElement("input");
input.id = "image6"
input.type="button";
input.value="Image6";
input.onclick = function(){
if(!localStorage.getItem("helpword")){
localStorage.setItem(localStorage.getItem("helpWord"),ProcessImages()[5])
localStorage.removeItem("helpword");
}
if(unknownwords[2] !== undefined && count < 1){
askForHelp(unknownwords[2]);
count++;
}
$("[indexValue=5]").click();
}
input.setAttribute("style", "font-size:18px;");
document.getElementById("formVerify").appendChild(input);
//Global variables
var words = [];
var undefinedWords = [];
var imageSrc = [];
var clickImage = [];
var count = 0;
//Avoid conflicts
this.$ = this.jQuery = jQuery.noConflict(true);
$(document).ready(function()
{
unknownwords = UnknownWords();
knownwords = KnownWords();
console.log("Unknown words " + unknownwords);
console.log("Known words " + knownwords);
// ask user for help with first word
if(unknownwords[1] !== undefined){
askForHelp(unknownwords[1]);
}
knownwords.forEach(function(word){
matchfound = 0;
console.log("processing known word:" + word)
// get value from storage and click the corresponsding image;
ProcessImages().forEach(function(image,counter){
console.log("counter: " + counter);
if(localStorage.getItem(word) == image){
console.log("found match for word " + word);
matchfound = 1;
$("[indexValue='"+counter+"']").click();
}else if(counter === 5 && matchfound === 0){
location.reload();
}
})
})
});
function askForHelp(word){
alert("We need help for the word:" + word);
localStorage.setItem("helpWord",word);
}
function UnknownWords(){
var unknownwords = [];
Words().forEach(function(word){
if(!localStorage.getItem(word)){
unknownwords.push(word);
}
});
return unknownwords;
}
function KnownWords(){
var Knownwords = [];
Words().forEach(function(word){
if(localStorage.getItem(word)){
Knownwords.push(word);
}
});
return Knownwords;
}
function SaveWord(word, dataurl){
if(!localStorage.getItem(word)){
localStorage.removeItem(word);
localStorage.setItem(word, dataurl);
}else {
localStorage.setItem(word,dataurl);
}
}
function Words(){
var words = $("#formVerify").find("span").toArray();
var First = words[0].innerText;
var Second = words[1].innerText;
var Third = words[2].innerText;
return [First, Second, Third];
}
function Images(){
return $("[indexValue]").toArray();
}
function ConvertToDataUrl(img) {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
var dataURL = canvas.toDataURL("image/png");
return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
}
function MinimiseDataUrl(dataUrl,jump)
{
var a = "";
for(var i = 0; i < dataUrl.length; i=i+jump)
a += dataUrl.charAt(i);
return a;
}
function ProcessImages()
{
var imagedata = [];
Images().forEach(function(image, counter)
{
dataurl = ConvertToDataUrl(image)
imagedata.push(MinimiseDataUrl(MinimiseDataUrl(MinimiseDataUrl(dataurl, 5), 4),3));
})
return imagedata
}