1337x Extract Links and Images

extract links and images from inside the description page to the listing page

当前为 2023-06-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 1337x Extract Links and Images
  3. // @version 1.0
  4. // @description extract links and images from inside the description page to the listing page
  5. // @author JasonC
  6. // @match https://1337x.to/
  7. // @match https://1337x.to/*
  8. // @grant none
  9.  
  10. // @namespace https://greasyfork.org/users/165799
  11. // ==/UserScript==
  12.  
  13. var pause = true;
  14. var torRows = new Array();
  15. var torlist = document.getElementsByClassName('table-list-wrap')[0].children[0];
  16.  
  17. function FilterRows()
  18. {
  19. var filter = parseInt(prompt("Minimum Seeds","-1"));
  20. if (!isNaN(filter) && filter > 0){
  21. for(var i=1;i<torlist.rows.length;i++){
  22. if (parseInt(parseInt(torlist.rows[i].cells[1].innerText)) < filter) {
  23. torlist.deleteRow(i);i--;
  24. }
  25. }
  26. }
  27. filter = parseInt(prompt("Minimum Leeches","-1"));
  28. if (!isNaN(filter) && filter > 0){
  29. for(var j=1;j<torlist.rows.length;j++){
  30. if (parseInt(parseInt(torlist.rows[j].cells[2].innerText)) < filter) {
  31. torlist.deleteRow(j);j--;
  32. }
  33. }
  34. }
  35. for (var l=1;l<torlist.rows.length;l++)
  36. {
  37. torRows.push(torlist.rows[l]);
  38. }
  39. }
  40.  
  41. function ExtractImage()
  42. {
  43. if (pause){return;}
  44. var torRow = torRows.shift();
  45. torRow.cells[0].style.overflow = "auto";
  46. torRow.cells[0].style.maxWidth = "400px";
  47. torRow.cells[1].style.verticalAlign = "top";
  48. var torurl = torRow.cells[0].children[1].href;
  49. console.log(torurl);
  50. $.get(torurl, function (html) {
  51. if (html) {
  52. try
  53. {
  54. $(html).find("#description").find("A").each(function() {
  55. var link = document.createElement("A");
  56. link.style.maxWidth = "400px";
  57. link.href = $(this).attr('href');
  58. link.innerHTML = $(this).html();
  59. torRow.cells[0].appendChild(document.createElement("br"));
  60. torRow.cells[0].appendChild(link);
  61. });
  62. $(html).find("#description").find("IMG").each(function() {
  63. var img = document.createElement("IMG");
  64. img.src = $(this).attr('data-original');
  65. img.style.maxWidth = "400px";
  66. torRow.cells[0].appendChild(document.createElement("br"));
  67. torRow.cells[0].appendChild(img);
  68. });
  69. }
  70. catch(e){}
  71. finally
  72. {
  73. //this.parentElement.removeChild(this);
  74. if (torRows.length > 0){
  75. ExtractImage();}
  76. }
  77. }
  78. },'html');
  79. }
  80.  
  81. (function() {
  82. var MainBtn = document.createElement('INPUT');
  83. MainBtn.type = 'button';
  84. MainBtn.style.position = 'fixed';
  85. MainBtn.style.top = '10px';
  86. MainBtn.style.left = '10px';
  87. MainBtn.style.zIndex = "9999";
  88. MainBtn.value = 'Start';
  89. MainBtn.onclick = function() {
  90. pause = !pause;
  91. if (pause){
  92. MainBtn.value = "Stop";
  93. }
  94. else{
  95. MainBtn.value = "Start";
  96. }
  97. FilterRows();
  98. ExtractImage();
  99. };
  100. document.body.appendChild(MainBtn);
  101. })();