E621/926 API Parser

Images direct links ripper for pages with search results

2019-08-23 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name			E621/926 API Parser
// @version			2019.08.23.1
// @description		Images direct links ripper for pages with search results
// @description:ru	Рипалка ссылок в результатах поиска, для менеджеров закачки
// @include			http*://e621.net/*
// @include			http*://e926.net/*
// @author			Rainbow-Spike
// @namespace		https://greasyfork.org/users/7568
// @homepage		https://greasyfork.org/ru/users/7568-dr-yukon
// @icon			https://www.google.com/s2/favicons?domain=e621.net
// @grant			none
// @run-at			document-end
// ==/UserScript==

var skript = document.getElementById ( 'blacklisted-images' ).innerHTML, // жабаем текст скрипта в конце страницы
    regulyarka = /\"file_url\":\"([^\"]+)\"/g, // с чем сравниваем
    poisk, // заранее готовим исполнитель поиска
    tekst = '', // текстуха для сборки итогов
    spanka = document.createElement ( 'span' ), // вставка
    mesto = document.getElementById ( 'subnav' ); // куда класть вставку

// SELECT
function selectblock ( name ) {
	var rng = document.createRange ( );
	rng.selectNode (name);
	var sel = window.getSelection ( );
	sel.removeAllRanges ( );
	sel.addRange ( rng );
}

while ( ( poisk = regulyarka.exec ( skript ) ) !== null ) { // пока в скрипте есть годные строки
	if ( window.location.href.indexOf ( 'e926' ) !== -1 ) poisk[1] = 'http:' + poisk[1]; // поправочка для e926.net - дописать протокол http: в ссылки
	tekst += '<a href="' + poisk[1] + '">' + poisk[1] + '</a> '; // выдрать адреса из строк и соорудить ссылки
	tekst += '<br />';
}
spanka.innerHTML = tekst; // втыкнуть всё это во вставку
mesto.appendChild ( spanka ); // спойлер прицепить в текст
mesto.style.cssText += "column-gap: 10px; column-count: 3; max-height: 200px; overflow: auto;";
// раскомментировать, если ссылки торчат некрасиво
// spanka.style = 'display: none;' // скрытие окружения

selectblock ( spanka );