// ==UserScript== // @name Grab All Uploads Info // @namespace PXgamer // @version 0.3 // @description Grabs a list of all uploads and their data for a certain user. // @author PXgamer // @include *kat.cr/user/*/uploads/* // @grant none // @downloadURL none // ==/UserScript== /*jshint multistr: true */ (function() { 'use strict'; // Defines vars var defined = { first_page: '1', last_page: $('.pages a.turnoverButton.siteButton.bigButton[rel="nofollow"]:last').text(), data_list: [], user: location.href.split('/')[4], data_type: location.href.split('/')[6] }; var eMatch = { titles: [], magnets: [], torrents: [], urls: [] }; if (defined.last_page === '') { defined.last_page = '1'; } $('h2').after('Grab uploads list'); $('.grabUploadsList').on('click', function() { console.log('Constructing List. Please wait...'); console.info(defined); for (var i = 1; i <= defined.last_page; i++) { var url = 'https://kat.cr/user/'+defined.user+'/uploads/'+defined.data_type+'?page=' + i; var ss_title = /(.*)<\/a>/ig; var ss_url = /.*<\/a>/ig; var ss_magnet = /<\/i><\/a>/ig; var ss_torrent = /<\/i><\/a>/ig; var matches; $.ajax({ type: "GET", url: url, async: false, success: function (data) { var e = 0; while (matches = ss_title.exec(data.html)) { eMatch.titles.push(matches[1]); } while (matches = ss_magnet.exec(data.html)) { eMatch.magnets.push(matches[1]); } while (matches = ss_torrent.exec(data.html)) { eMatch.torrents.push('https://kat.cr' + matches[1]); } while (matches = ss_url.exec(data.html)) { eMatch.urls.push('https://kat.cr' + matches[1]); } }, returnData: "json" }); } for (var k = 0; k < eMatch.titles.length; k++) { defined.data_list.push({ title: eMatch.titles[k], magnet: eMatch.magnets[k], torrent: eMatch.torrents[k], url: eMatch.urls[k] }); } console.log(defined.data_list); }); })();