Anti-DMCA script for KAT

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

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

  1. // ==UserScript==
  2. // @name Anti-DMCA script for KAT
  3. // @include http*://kickass.so/*.html*
  4. // @include http*://kickass.to/*.html*
  5. // @include http*://kat.ph/*.html*
  6. // @include http*://kat.cr/*.html*
  7. // @include http*://kickassto.co/*.html*
  8. // @include http*://katproxy.is/*.html*
  9. // @include http*://thekat.tv/*.html*
  10. // @version 2.5
  11. // @grant none
  12. // @description Started by PXgamer & UnDeAd.YeTii (making the magnet link)
  13. // @namespace https://greasyfork.org/users/9596
  14. // ==/UserScript==
  15.  
  16. // if on torrent page and if DMCA'd
  17. if (/-t\d+\.html($|#.*)/.test(window.location.pathname)&&$('.alertfield').length) {
  18. // add tracker tab
  19. $('.tabs .tabNavigation li:first').after(' <li><a href="#technical" rel="technical" class="darkButton"><span>Technical</span></a></li>')
  20. // get hash and name for magnet link
  21. var hash = $('#tab-technical .lightgrey').text().split(': ')[1];
  22. var name = window.location.pathname.split('/')[1];
  23. name = name.substring(0, name.lastIndexOf("-"));
  24. // compile technical stats
  25. var trackers = [];
  26. $('#trackers_table tr:not(.firstr)').each(function() {
  27. trackers.push({'url':$('td:eq(0)', $(this)).text(), 'seed':padNum($('td:eq(3)', $(this)).text()), 'leech':padNum($('td:eq(4)', $(this)).text())});
  28. })
  29. // get highest seed and tracker for it
  30. trackers.sort(function(a, b) {
  31. var x = a['seed']; var y = b['seed'];
  32. return ((x < y) ? -1 : ((x > y) ? 1 : 0));
  33. });
  34. var seed = parseInt(trackers[trackers.length-1].seed);
  35. var tracker = trackers[trackers.length-1].url;
  36. // get highest leech
  37. trackers.sort(function(a, b) {
  38. var x = a['leech']; var y = b['leech'];
  39. return ((x < y) ? -1 : ((x > y) ? 1 : 0));
  40. });
  41. var leech = parseInt(trackers[trackers.length-1].leech);
  42. // if no seeders, try the one with leechers
  43. if (seed == 0 && leech > 0)
  44. var tracker = trackers[trackers.length-1].url;
  45.  
  46. 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>';
  47.  
  48. var verified = $('.tabs.tabSwitcher').prev().text().indexOf('Torrent verified') >= 0;
  49. 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>';
  50. $('.alertfield').after(values+buttonGroup);
  51. }
  52.  
  53. function padNum(num) { // 123 ==> 000123
  54. num = '00000000'+num;
  55. return num.substring(num.length-7, num.length);
  56. }