KissAnime Auto Captcha V3.2

Auto complete KissAnime Captcha

安装此脚本?
作者推荐脚本

您可能也喜欢KissAnime Downloader

安装此脚本
  1. // ==UserScript==
  2. // @name KissAnime Auto Captcha V3.2
  3. // @namespace https://greasyfork.org/en/users/135934-elti-musa
  4. // @version 3.2.1
  5. // @description Auto complete KissAnime Captcha
  6. // @author AnimeBro1
  7. // @match http://kissanime.ru/Special/AreYouHuman2*
  8. // @grant GM_setValue
  9. // @run-at document-end
  10. // @grant GM_getValue
  11. // @grant GM_listValues
  12. // @grant GM_deleteValue
  13. // @grant GM_xmlhttpRequest
  14. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
  15. // ==/UserScript==
  16.  
  17.  
  18. var words = [];
  19. var imagesURL;
  20. var count = 0;
  21. var images = ["","","",""];
  22. var imagecount = 0;
  23. var imageURLcount = 0;
  24. var w;
  25.  
  26. (function() {
  27. $("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>');
  28.  
  29. if(!isBasicJson()){
  30. alert("FIRST TIME RUNNING: Make sure you REMOVE previous version of the script.");
  31. factoryReset();
  32. getBasicJson();
  33. }else{
  34. words = getWords();
  35. imagesURL = $("[indexValue]").toArray();
  36. toDataURL(imagesURL[0].src,function(data){DONE(data);});
  37. }
  38. })();
  39.  
  40. function DONE(a){
  41. //alert(imageURLcount);
  42. imageURLcount++;
  43.  
  44. images[imagecount] = cutImage64(cutImage64(a,3),2);
  45. if(imagecount == 3){
  46. console.log(images);
  47. Complete();
  48. }else{
  49. toDataURL(imagesURL[imageURLcount].src,function(data){DONE(data);});
  50. imagecount++;
  51. }
  52. }
  53.  
  54. function getWords(){
  55. var words = $("#formVerify").find("span").toArray();
  56. var First = words[0].innerText;
  57. var Second = words[1].innerText;
  58. return [First, Second];
  59. }
  60.  
  61. function cutImage64(base64,s){
  62. var a = "";
  63. for(var i = 0; i < base64.length; i=i+s){
  64. a += base64.charAt(i);
  65. }
  66. return a;
  67. }
  68.  
  69. function toDataURL(url, callback) {
  70. var xhr = new XMLHttpRequest();
  71. xhr.onload = function() {
  72. var reader = new FileReader();
  73. reader.onloadend = function() {
  74. callback(reader.result);
  75. };
  76. reader.readAsDataURL(xhr.response);
  77. };
  78. //alert("http://kissanime.ru/Special/"+url);
  79. xhr.open('GET', url);
  80. xhr.responseType = 'blob';
  81. xhr.send();
  82. }
  83.  
  84. function getBasicJson(){
  85. $("#CaptchaInfo").show();
  86. $("#CaptchaInfo").find("p").html("First time running, fetching some files... Page will reload.");
  87. var msg='';
  88. //msg = $.ajax({type: "GET", url: "https://cdn.rawgit.com/Eltion/Kissanime-Chaptcha-Auto-Complete/111255eebd4ee25aaa2ad6d072b75ae446217d97/KissAnime.Downloader.Chaptcha.Database.json", async: false}).responseText;
  89. GM_xmlhttpRequest({
  90. method: "GET",
  91. url: "https://cdn.rawgit.com/Eltion/Kissanime-Chaptcha-Auto-Complete/eee0c4153d22cec5a5327efc8d7d8ba3b37394d9/KissAnime.Downloader.Chaptcha.Database2.json",
  92. synchronous: true,
  93. onload: function(response) {
  94. msg = response.responseText;
  95. msg = JSON.parse(msg);
  96. for(var i = 0; i < msg.length; i++){
  97. GM_setValue(msg[i].n,msg[i].v);
  98. }
  99. location.reload();
  100. }
  101. });
  102. }
  103. function isBasicJson(){
  104. return GM_getValue("AnimeBro3",false);
  105. }
  106.  
  107. function factoryReset(){
  108. var keys = GM_listValues();
  109. for (var i=0; i < keys.length; i++) {
  110. GM_deleteValue(keys[i]);
  111. }
  112. }
  113.  
  114. function Complete() {
  115. var jj = 0;
  116. console.log(images);
  117. for(var j = 0; j <2; j++){
  118. var w1 = GM_getValue(words[j], false);
  119. if(w1 !== false){
  120. if(w1.includes(" ")){
  121. w1 = w1.split(" ");
  122. }else{
  123. w1 = [w1];
  124. }
  125. for(var k =0; k < w1.length; k++){
  126. for(var i = 0; i < images.length; i++){
  127. if(images[i] === w1[k]){
  128. $("[indexValue='"+i+"']").click();
  129. jj++;
  130. }
  131. }
  132. }
  133. }
  134. }
  135. if(jj < 2){
  136. location.reload();
  137. }
  138. //UpdateTest(jj);
  139. //Learn();
  140. }