Anti-DMCA script for KAT

Started by PXgamer & UnDeAd.YeTii (making the magnet link)

目前为 2015-07-14 提交的版本。查看 最新版本

// ==UserScript==
// @name        Anti-DMCA script for KAT
// @include     http*://kickass.so/*.html*
// @include     http*://kickass.to/*.html*
// @include     http*://kat.ph/*.html*
// @include     http*://kat.cr/*.html*
// @include     http*://kickassto.co/*.html*
// @include     http*://katproxy.is/*.html*
// @include     http*://thekat.tv/*.html*
// @version     2.5
// @grant       none
// @description Started by PXgamer & UnDeAd.YeTii (making the magnet link)
// @namespace   https://gf.qytechs.cn/users/9596
// ==/UserScript==

// if on torrent page and if DMCA'd
if (/-t\d+\.html($|#.*)/.test(window.location.pathname)&&$('.alertfield').length) {
    // add tracker tab
    $('.tabs .tabNavigation li:first').after(' <li><a href="#technical" rel="technical" class="darkButton"><span>Technical</span></a></li>')
    
    // get hash and name for magnet link
    var hash = $('#tab-technical .lightgrey').text().split(': ')[1];
    var name = window.location.pathname.split('/')[1];
    name = name.substring(0, name.lastIndexOf("-"));
    
    // compile technical stats
    var trackers = [];
    $('#trackers_table tr:not(.firstr)').each(function() {
      trackers.push({'url':$('td:eq(0)', $(this)).text(), 'seed':padNum($('td:eq(3)', $(this)).text()), 'leech':padNum($('td:eq(4)', $(this)).text())});
    })
    
    // get highest seed and tracker for it
    trackers.sort(function(a, b) {
       var x = a['seed']; var y = b['seed'];
       return ((x < y) ? -1 : ((x > y) ? 1 : 0));
    });
    var seed = parseInt(trackers[trackers.length-1].seed);
    var tracker = trackers[trackers.length-1].url;
    
    // get highest leech
    trackers.sort(function(a, b) {
       var x = a['leech']; var y = b['leech'];
       return ((x < y) ? -1 : ((x > y) ? 1 : 0));
    });
    var leech = parseInt(trackers[trackers.length-1].leech);
    // if no seeders, try the one with leechers
    if (seed == 0 && leech > 0)
        var tracker = trackers[trackers.length-1].url;

    var values = '<div class="seedLeachContainer" title="These are the last updated values, they are likely not up to date"><div class="seedBlock"><span class="seedLeachIcon"></span>seeders: <strong itemprop="seeders">'+seed+'</strong></div><div class="leechBlock"><span class="seedLeachIcon"></span>leechers: <strong itemprop="leechers">'+leech+'</strong></div></div>';

    var verified = $('.tabs.tabSwitcher').prev().text().indexOf('Torrent verified') >= 0;
    
    var buttonGroup = '<div class="buttonsline downloadButtonGroup clearleft novertpad"><a title="Add torrent to personal RSS" href="/bookmarks/add/rss/'+hash+'/" class="siteButton giantIcon rssButton postLink"><span></span></a> <a title="Magnet link" href="magnet:?xt=urn:btih:'+hash+'&dn='+name+'&tr='+tracker+'" class="siteButton giantIcon magnetlinkButton askFeedbackjs" data-id="'+hash+'"><span></span></a> <a rel="nofollow" title="Download torrent file (if it does not work, try magnet link)" href="http://torcache.net/torrent/'+hash+'.torrent" class="siteButton giantButton askFeedbackjs    '+(verified?'verifTorrentButton':'')+'"><span>'+(verified?'<em class="buttonPic"></em>':'')+'Download torrent</span></a></div>';
    $('.alertfield').after(values+buttonGroup);
}

function padNum(num) { // 123 ==> 000123
    num = '00000000'+num;
    return num.substring(num.length-7, num.length);
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址