Anti-DMCA script for KAT

Started by PXgamer & Chev.Chelios

  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.6
  11. // @grant none
  12. // @description Started by PXgamer & Chev.Chelios
  13. // @namespace https://greasyfork.org/users/9596
  14. // ==/UserScript==
  15. // if on torrent page and if DMCA'd
  16. if (/-t\d+\.html($|#.*)/.test(window.location.pathname)&&$('#mainDetailsTable .alertfield').length) {
  17. var torrent_id = window.location.pathname.match(/-t(\d+)\.html($|#.*)/)[1];
  18. var logged_in = $('#navigation > li:last > a[href^="/user/"]').length>0;
  19. $('.tabs .tabNavigation li:first').after(' <li><a href="#technical" rel="technical" class="darkButton"><span>Technical</span></a></li>');
  20. var hash = $('#tab-technical .lightgrey').text().split(': ')[1];
  21. var name = window.location.pathname.split('/')[1];
  22. name = name.substring(0, name.lastIndexOf("-"));
  23. var values = '<div class="seedLeachContainer"><div class="leechBlock"><i class="ka kaBox ka-DMCA"></i>Anti-DMCA</div><div class="seedBlock"><i class="ka kaBox ka-idea"></i>Created by: <strong>PXgamer, Chev.Chelios &amp; KLOSENTAR</strong></div><div class="timeBlock"><i class="ka kaBox ka-faq"></i>How to: <strong><a class="plain" href="https://www.google.com/search?q=how+to+download+magnet+links&amp;ie=utf-8&amp;oe=utf-8" target="_blank">Download magnet links</a></strong></div></div>';
  24. var trackers = '';
  25. $('#trackers_table tr:not(.firstr)').each(function() {
  26. if ($(this).find('td.green').length) trackers += '&tr='+euc($(this).find('td:first').text());
  27. });
  28. if (trackers.length === 0) tr = '&tr='+euc('udp://tracker.publicbt.com:80/announce');
  29. var verified = $('.tabs.tabSwitcher').prev().text().indexOf('Torrent verified') >= 0;
  30. var messagetext = "Hey,\nyou can still download this torrent:\n[torrent="+torrent_id+"]\nby using one of these methods (I use method 3):\n[thread=bb7595776]\nSpread the word\n\nP.S. Screw [url=\"/dmca/\"]DMCA[/url] [:Qpirate]";
  31. var buttons = '<div class="buttonsline downloadButtonGroup clearleft novertpad">'+(logged_in?'<a class="kaGiantButton ajaxLink" href="/messenger/create/?text='+euc(messagetext)+'" title="Send in a private message"><i class="ka ka-message"></i></a>':'')+' <a class="kaGiantButton magnet_fb" data-nop="" title="Magnet link" href="magnet:?xt=urn:btih:'+hash+'&dn='+name+trackers+'" data-id="'+hash+'"><i class="ka ka-magnet"></i></a> <a rel="nofollow" class="kaGiantButton siteButton'+(verified?' iconButton':'')+'" title="Download'+(verified?' verified':'')+' torrent file)" href="http://torcache.net/torrent/'+hash+'.torrent">'+(verified?'<i class="ka ka-verify"></i>':'')+'<span>Download torrent</span></a> <span style="margin-top: 6px; display: inline-block;" class="lightgrey font11px">(Try magnet link if Torcache doesn\'t work)</span></div>';
  32. var magnetfb = '<div id="magnet_fb" style="display:none;"><h2 class="center">Thank you for choosing Anti-<i style="line-height: 19px ! important; margin-left: -3px;" title="(DMCA)" class="ka ka-DMCA statusIcon"></i></h2><div style="width: 550px;" class="center">We hope your download works.<br>Keep in mind that it is mainly up to whether or not people remain seeding this torent.<br>If you need any assistance, check out the thread:<br><a href="/community/show/95496/"><strong>Various methods to download a DMCA\'ed torrent</strong></a></div></div>';
  33. $('.alertfield').after(values+buttons+magnetfb);
  34. $('.downloadButtonGroup .ajaxLink').fancybox();
  35. $(document).delegate('.magnet_fb', 'click', function() {
  36. $('<a/>').attr('href', '#magnet_fb').fancybox().click();
  37. });
  38. }
  39. function euc(str) {
  40. return encodeURIComponent(str);
  41. }
  42. function padNum(num) { // 123 ==> 000123
  43. num = '00000000'+num;
  44. return num.substring(num.length-7, num.length);
  45. }