nyaa show

自动加载nyaa图片并显示!

  1. // ==UserScript==
  2. // @name nyaa show
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description 自动加载nyaa图片并显示!
  6. // @author You
  7. // @grant GM_xmlhttpRequest
  8. // @include https://sukebei.nyaa.si/*
  9. // @require https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js
  10. // ==/UserScript==
  11. (function () {
  12. var a = document.getElementById("torrent-description");
  13. var patt1 = new RegExp("https://hentai-covers.site/image/[0-9a-zA-Z]*");
  14. if (patt1.test(a.innerHTML)) {
  15. var im = patt1.exec(a.innerHTML);
  16. GM_xmlhttpRequest({
  17. method: "GET",
  18. url: im[0],
  19. Referer: im[0],
  20. headers: {
  21. 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36',
  22. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
  23. },
  24. onload: function (response) {
  25. var regex1 = new RegExp("https\:\/\/hentai\-covers\.site\/images\/[0-9]+\/[0-9]+\/[0-9]+\/[a-zA-Z0-9-_.]*.(jpg|webp)");
  26. var temp = regex1.exec(response.responseText);
  27. var board = document.getElementById("torrent-description");
  28. var img = document.createElement("img");
  29. GM_xmlhttpRequest({
  30. method: "GET",
  31. url: temp[0],
  32. Referer:im[0],
  33. responseType :'blob',
  34. headers: {
  35. 'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36',
  36. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
  37. 'Referer':im[0],
  38. },
  39. onload: function (response) {
  40. if (this.status == 200) {
  41. var blob = this.response
  42. var link = window.URL.createObjectURL(blob)
  43. img.src = link
  44. img.onload = function() {
  45. window.URL.revokeObjectURL(this.src);
  46. }
  47. board.appendChild(img)
  48. }
  49. }
  50. })
  51.  
  52.  
  53. }
  54. });
  55. }
  56.  
  57. })();