Direct Image Link E621/926 & e6AI

Рипалка ссылок в результатах поиска, для менеджеров закачки

Fra og med 09.05.2023. Se den nyeste version.

  1. // ==UserScript==
  2. // @name Direct Image Link E621/926 & e6AI
  3. // @name:en Direct Image Link E621/926 & e6AI
  4. // @version 2023.05.09.1
  5. // @description:en Images direct links ripper for pages with search results
  6. // @description Рипалка ссылок в результатах поиска, для менеджеров закачки
  7. // @match http*://e621.net/posts?*
  8. // @match http*://e621.net/pool*
  9. // @match http*://e926.net/posts?*
  10. // @match http*://e926.net/pool*
  11. // @match http*://e6ai.net/posts?*
  12. // @author Rainbow-Spike
  13. // @namespace https://greasyfork.org/users/7568
  14. // @homepage https://greasyfork.org/ru/users/7568-dr-yukon
  15. // @icon https://www.google.com/s2/favicons?domain=e621.net
  16. // @grant none
  17. // @run-at document-end
  18. // ==/UserScript==
  19.  
  20. var lever = 1, // 2 - post numbers, 1 - pic source, 0 - file name
  21. want = /[^_]pussy[^_]|tribadism/, // wanted tags
  22. unwant = /censored|gore|male\/male|my_little_pony/, // unwanted tags
  23. wrong = 0.3, // opacity of wrong tags
  24. have = 0.05, // opacity of already haved media
  25. stop = [
  26. '00000000000000000000000000000000', '00000000000000000000000000000000'
  27. ], // list of already haved MD5, INSERT YOUR'S!!
  28. artic = document . querySelectorAll ( '.post-preview' ),
  29. span = document . createElement ( 'span' ),
  30. mesto = document . querySelector ( '#top' ),
  31. x, tags, src, y, md5, name, link, num;
  32.  
  33. // SELECT
  34. function selectblock ( name ) {
  35. var rng = document . createRange ( );
  36. rng . selectNode ( name );
  37. var sel = window . getSelection ( );
  38. sel . removeAllRanges ( );
  39. sel . addRange ( rng );
  40. }
  41.  
  42. if ( artic != null ) {
  43. for ( x = 0; x < artic . length; x++ ) {
  44. tags = artic [ x ] . getAttribute ( 'data-tags' );
  45. if ( want . test ( tags ) && !unwant . test ( tags ) ) {
  46. src = artic [ x ] . getAttribute ( 'data-file-url' );
  47. md5 = src . split ( '/' );
  48. name = md5 [ md5 . length - 1 ];
  49. md5 = name . split ( '.' ) [ 0 ];
  50. for ( y = 0; y < stop . length; y++ ) {
  51. if ( stop [ y ] == md5 ) {
  52. artic [ x ] . style = 'opacity: ' + have;
  53. md5 = '';
  54. break;
  55. };
  56. };
  57. if ( lever == 2 ) {
  58. num = artic [ x ] . getAttribute ( 'data-id' );
  59. span . innerHTML += num + '<br>';
  60. } else if ( md5 != '' ) {
  61. span . innerHTML += '<a href = "' + src + '">' + ( lever ? src : name ) + ' </a><br>'; /* select link */
  62.  
  63. link = document . createElement ( 'a' ); /* thumb link */
  64. link . setAttribute ( 'href', src );
  65. link . innerHTML = md5;
  66. link . style = 'word-wrap: anywhere;';
  67. artic [ x ] . appendChild ( link );
  68. }
  69. } else {
  70. artic [ x ] . style = 'opacity: ' + wrong;
  71. }
  72. }
  73. span . style = 'display: inline-block; column-gap: 3px; column-count: 7; font-size: 40%; line-height: .25em; max-height: 200px; overflow: auto;';
  74. if ( mesto != null ) mesto . appendChild ( span );
  75. selectblock ( span );
  76. }