// ==UserScript== // @name IMDB Scout // @namespace https://greasyfork.org/users/1057-kannibalox // @description Add links from IMDB movie pages to torrent sites -- easy downloading from IMDB // // Preference window for userscripts, hosted by greasyfork: // @require https://greasyfork.org/libraries/GM_config/20131122/GM_config.js // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js // // @version 2.21 // @include http://*.imdb.com/title/tt* // @include http://*.imdb.de/title/tt* // @include http://*.imdb.es/title/tt* // @include http://*.imdb.fr/title/tt* // @include http://*.imdb.it/title/tt* // @include http://*.imdb.pt/title/tt* // @include http://*.imdb.com/search/title* // @include http://*.imdb.de/search/title* // @include http://*.imdb.es/search/title* // @include http://*.imdb.fr/search/title* // @include http://*.imdb.it/search/title* // @include http://*.imdb.pt/search/title* // // @grant GM_log // @grant GM_getValue // @grant GM_setValue // @grant GM_addStyle // @grant GM_openInTab // @grant GM_xmlhttpRequest // @grant GM_registerMenuCommand // // @downloadURL none // ==/UserScript== /*---------------------Version History-------------------- 1.00 - Initial public release, everything works on barebones greasemonkey 1.50 - Added the ability to select which sites to load from the GM script commands - Moved the required method to userscripts - Removed FH, NZB, Avax 1.60 - Added style elements and shading to display on imdb 1.62 - Fixed bug:SCC-ARC not removing when unchecked - Alphabetized list 1.70 - Cleaned up code - Added option to not run script on page load 1.71 - Deprecated action-box field 1.80 - Added icons that link to OpenSubs, Criticker, RT, YT 1.81 - Added support for tv, only displays on shows listed as 'tv series' - Added support for icheckmovies at top bar. 1.82 - Fixed title parsing for tv shows. 1.83 - Fixed dhive not working properly 1.90 - Set height of preference window to 450px, added scroll bar 1.91 - Added another 11 torrent sites 2.00 - Added auto updater 2.01 - Added TC, FreshOn, TVT, STF, CC - Cleaned up code (tabbing) - Removed THR - Added TV-Rage to top bar 2.02 - Added PS, THC, HH, HDStar - Fixed CC false positive 2.03 - TehC now uses tt - Added Raymoz mod for AT 2.04 - Added HDbits - Added TL 2.10 - Added genre page search functionality 2.11 - Fixed ICM because Nuked was whining 2.12 - Removed tvrage - Fixed iCM (added tt) - Added HDVNbits - Changed RevTT to .me - Added HDT - removed autoupdate 2.13 - removed xvidme - reinstated autoupdate - removed google chrome code - fixed hdvn and hdt issues 2.14 - Added @grant entries for API access - Fixed tt parser to work on imdb pages with referral info in url 2.2 - Switch preferences window to use GM_config - Consolidate icon & site lists - Added IPT, KASS, sHD, and HDW - Fix "Open All" link - Add option for strikethroughs on search page - Removed arrays from search URLs - Spring cleaning 2.21 - Added SSL to TVT, HDME, TC, AHD, IPT, SCC - Added SSL option for CG - Added GFT, GFT-Gems, GFT-TV - Fixed SCC, SCC-ARC search URL - Removed TheBox, TheDVDClub - Added more comments, cleaned up some more stuff --------------------------------------------------------*/ //------------------------------------------------------ // A list of all the sites, and the data necessary to // check IMDB against them. // To create a search URL, there are three parameters // you can use inside the URL: // - %tt%: The IMDB id with the tt prefix // - %nott%: The IMDB id without the tt prefix // - $search_string%: The movie title // See below for examples //------------------------------------------------------ var sites = [ { 'name': 'BTN', 'searchUrl': 'https://broadcasthe.net/torrents.php?searchstr=%search_string%', 'matchRegex': /Whatchoo talkin' bout willis?.<\/h2>/, 'TV': true}, { 'name': 'BTN-Req', 'searchUrl': 'https://broadcasthe.net/requests.php?search=%search_string%', 'matchRegex': /Whatchoo talkin' bout willis?.<\/h2>/, 'TV': true}, { 'name': 'TVV', 'searchUrl': 'http://tv-vault.me/torrents.php?searchstr=%search_string%', 'matchRegex': /Nothing found<\/h2>/, 'TV': true}, { 'name': 'BMTV', 'searchUrl': 'https://www.bitmetv.org/browse.php?search=%search_string%', 'matchRegex': /Nothing found!<\/h2>/, 'TV': true}, { 'name': 'Fresh', 'searchUrl': 'http://freshon.tv/browse.php?search=%search_string%', 'matchRegex': /Nothing found!<\/h2>/, 'TV': true}, { 'name': 'TvT', 'searchUrl': 'https://www.tvtorrents.com/loggedin/search.do?search=%search_string%', 'matchRegex': /Nothing found!<\/h2>/, 'TV': true}, { 'name': 'AT', 'searchUrl': 'http://www.asiatorrents.com/index.php?page=torrents&options=3&search=%tt%', 'matchRegex': /torrent_history/, 'success_match': true}, { 'name': 'HDVN', 'searchUrl': 'http://hdvnbits.org/torrents.php?search=%tt%&search_area=4&search_mode=0', 'matchRegex': /Nothing found! Try again with a refined search string/}, { 'name': 'HDT', 'searchUrl': 'http://hd-torrents.org/torrents.php?active=0&options=2&search=%tt%', 'matchRegex': /No torrents here.../}, { 'name': 'TL', 'searchUrl': 'http://www.torrentleech.org/torrents/browse/index/query/%search_string%', 'matchRegex': /Signup With Invite|Please refine your search./}, { 'name': 'HDb', 'searchUrl': 'http://hdbits.org/browse2.php#film/dir=null&searchtype=film&actorfilm=film&search=%tt%', 'matchRegex': /

Note: You need cookies enabled to log in.<\/p>/}, { 'name': 'CG', 'searchUrl': 'http://cinemageddon.net/browse.php?search=%tt%', 'matchRegex': /

Nothing found!<\/h2>|

Not logged in!<\/h1>/}, { 'name': 'CG-SSL', 'searchUrl': 'https://cinemageddon.net/browse.php?search=%tt%', 'matchRegex': /

Nothing found!<\/h2>|

Not logged in!<\/h1>/}, { 'name': 'TPB', 'searchUrl': 'https://thepiratebay.org/search/%tt%', 'matchRegex': /No hits. Try adding an asterisk in you search phrase.<\/h2>/}, { 'name': 'Demo', 'searchUrl': 'http://www.demonoid.me/files/?query=%tt%', 'matchRegex': /No torrents found<\/b>|We are currently performing the daily site maintenance.
/}, { 'name': 'Kara', 'searchUrl': 'https://www.karagarga.net/browse.php?search_type=imdb&search=%nott%', 'matchRegex': /

No torrents found<\/h2>|

If you want the love<\/h1>/}, { 'name': 'Tik', 'searchUrl': 'http://cinematik.net/browse.php?srchdtls=1&incldead=1&search=%tt%', 'matchRegex': /The page you tried to view can only be used when you're logged in|

Nothing found!<\/h2>/}, { 'name': 'SM', 'searchUrl': 'http://www.surrealmoviez.info/advanced_search.php?simdb=%tt%', 'matchRegex': /0 Movies found matching search criteria|You need to be logged in to view this page/}, { 'name': 'ILC', 'searchUrl': 'http://www.iloveclassics.com/browse.php?incldead=1&searchin=2&search=%tt%', 'matchRegex': /Try again with a refined search string|

Not logged in!<\/h1>/}, { 'name': 'Goem', 'searchUrl': 'http://goem.org/browse.php?s_type=2&cat=0&search=%tt%', 'matchRegex': /Try again with a refined searchstring|

Note: You need cookies enabled to log in.<\/h1>/}, { 'name': 'SCC', 'searchUrl': 'https://sceneaccess.org/browse?method=3&search=%tt%', 'matchRegex': /Try again with a refined search string.|

Note: Three (3) failed login attempts will result in a temporary security lockout.<\/h1>/}, { 'name': 'SDBits', 'searchUrl': 'http://sdbits.org/browse.php?c6=1&c3=1&c1=1&c4=1&c5=1&c2=1&m1=1&incldead=0&from=&to=&imdbgt=0&imdblt=10&uppedby=&imdb=&search=%tt%', 'matchRegex': /Nothing found!|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'eThor', 'searchUrl': 'http://ethor.net/browse.php?stype=b&c23=1&c20=1&c42=1&c5=1&c19=1&c25=1&c6=1&c37=1&c43=1&c7=1&c9=1&advcat=0&incldead=0&includedesc=1&search=%tt%', 'matchRegex': /Try again with a refined search string.|

Note: Vous devez activer vos 'cookies' pour pouvoir vous identifier.<\/h1>/}, { 'name': 'x264', 'searchUrl': 'http://x264.me/browse.php?incldead=0&xtype=0&stype=3&search=%tt%', 'matchRegex': /Try again with a refined search string.|

Forgot your password?<\/h1>/}, { 'name': 'FSS', 'searchUrl': 'http://fss.omnilounge.co.uk/browse.php?blah=2&cat=0&incldead=1&search=%tt%', 'matchRegex': /Try again with a different search string?|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'HDME', 'searchUrl': 'https://hdme.eu/browse.php?blah=2&cat=0&incldead=1&search=%tt%', 'matchRegex': /Try again with a refined search string.|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'DHive', 'searchUrl': 'https://gks.gs/sphinx/?category=0&prez=&sort=normal&order=desc&q=%tt%', 'matchRegex': /Votre Recherche aucun|

Mot de passe<\/h1>/}, { 'name': 'CHD', 'searchUrl': 'http://chdbits.org/torrents.php?incldead=1&spstate=0&inclbookmarked=0&search_area=4&search_mode=0&search=%tt%', 'matchRegex': /Nothing found! Try again with a refined search string.|

You need cookies enabled to log in or switch language.<\/h1>/}, { 'name': 'PTP-Req', 'searchUrl': 'https://tls.passthepopcorn.me/requests.php?submit=true&search=%tt%', 'matchRegex': /Nothing found!|

Keep me logged in.<\/h1>/}, { 'name': 'ADVD', 'searchUrl': 'https://asiandvdclub.org/browse.php?descr=1&btnSubmit=Submit&search=%tt%', 'matchRegex': /Your search returned zero results|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'iPlay', 'searchUrl': 'http://www.iplay.ro/browse.php?genre=1&status=0&search=%tt%', 'matchRegex': /Try again with a refined search string|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'ScandBits', 'searchUrl': 'http://scanbits.org/browse.php?cat=0&incldead=0&mode=0&search=%tt%', 'matchRegex': /Try again with a refined search string|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'TE', 'searchUrl': 'http://theempire.bz/browse.php?incldead=0&country=&nonboolean=1&search=%tt%', 'matchRegex': /Try again with a refined search string|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'TG', 'searchUrl': 'http://thegeeks.bz/browse.php?incldead=0&country=&nonboolean=1&search=%tt%', 'matchRegex': /Try again with a refined search string|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'LL', 'searchUrl': 'http://www.leecherslair.com/browse.php?blah=1&incldead=0&search=%tt%', 'matchRegex': /Try again with a refined search string|

This site is under construction<\/h1>/}, { 'name': 'MT', 'searchUrl': 'http://www.maroctorrent.net/torrents-search.php?cat=42&incldead=1&search=%tt%', 'matchRegex': /Aucun torrent|

Les Cookies DOIVENT<\/h1>/}, { 'name': 'FY', 'searchUrl': 'https://fuckyeahtorrents.com/browse.php?_by=2&cat=0&search=%tt%', 'matchRegex': /Try again with a refined search string|

You need cookies enabled to log in.<\/h1>/}, { 'name': 'SCC-ARC', 'searchUrl': 'https://sceneaccess.org/archive?=&method=3&search=%tt%', 'matchRegex': /Try again with a refined search string.|

Note: Three (3) failed login attempts will result in a temporary security lockout.<\/h1>/}, { 'name': 'PTP', 'searchUrl': 'https://tls.passthepopcorn.me/torrents.php?imdb=%tt%', 'matchRegex': /

Your search did not match anything.<\/h2>/}, { 'name': 'BitHD', 'searchUrl': 'http://www.bit-hdtv.com/torrents.php?cat=0&description_search=1&search=%tt%', 'matchRegex': /

No match!<\/h2>/}, { 'name': 'RevTT', 'searchUrl': 'https://www.revolutiontt.me/browse.php?search=%tt%', 'matchRegex': /

Nothing found!<\/h2>/}, { 'name': 'AHD', 'searchUrl': 'https://awesome-hd.net/torrents.php?id=%tt%', 'matchRegex': /

Error 404<\/h2>/}, { 'name': 'TehC', 'searchUrl': 'https://tehconnection.eu/torrents.php?searchstr=%tt%', 'matchRegex': /You will be banned for 6 hours after your login attempts run out.|

No Search Results}/}, { 'name': 'CC', 'searchUrl': 'http://www.cine-clasico.com/foros/search.php?terms=any&author=&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search&keywords=%tt%', 'matchRegex': /You will be banned for 6 hours after your login attempts run out.|You must specify at least one word to search for. Each word must consist of at least 3 characters and must not contain more than 14 characters excluding wildcards.|Disculpe/}, { 'name': 'PS', 'searchUrl': 'http://polishsource.org/browse.php?incldead=0&scene=0&pl=0&sub=&search_in=both&free=0&search=%tt%', 'matchRegex': /Nic nie znaleziono|Musisz|login/}, { 'name': 'THC', 'searchUrl': 'http://horrorcharnel.kicks-ass.org/browse.php?title=3&search=%tt%', 'matchRegex': /

Not logged in!<\/h1>|Nothing found!/}, { 'name': 'HH', 'searchUrl': 'http://www.horrorhaven.org/search.php?stype=articles&stext=%tt%', 'matchRegex': /0 Articles found matching search criteria/}, { 'name': 'HDStar', 'searchUrl': 'http://www.hdstar.org/torrents.php?incldead=1&spstate=0&inclbookmarked=0&search_area=1&search_mode=0&search=%tt%', 'matchRegex': /Try again with a refined search string|You need cookies enabled to log in or switch language/}, { 'name': 'KASS', 'searchUrl': 'https://kickass.to/usearch/imdb%3A%nott%', 'matchRegex': /

Nothing found!<\/h2>/}, { 'name': 'IPT', 'searchUrl': 'https://www.iptorrents.com/torrents/?q=%tt%', 'matchRegex': /

Nothing found!<\/h2>|( 0 torrents )/}, { 'name': 'sHD', 'searchUrl': 'https://scenehd.org/browse.php?options&unpack&incldead&search=%search_string%', 'matchRegex': /

No torrents found!<\/h2>/}, { 'name': 'HDW', 'searchUrl': 'http://hdwing.com/browse.php?search=%search_string%', 'matchRegex': /

没找到任何内容!|对不起<\/h2>/}, { 'name': 'GFT', 'searchUrl': 'https://www.thegft.org/browse.php?view=0&c2=1&c1=1&c9=1&c11=1&c48=1&c8=1&c18=1&c49=1&c7=1&c38=1&c46=1&c5=1&c13=1&c26=1&c37=1&c19=1&c47=1&c17=1&c4=1&c22=1&c25=1&c20=1&c3=1&search=%tt%&searchtype=0', 'matchRegex': /Nothing found!<\/h2>/}, { 'name': 'GFT', 'searchUrl': 'https://www.thegft.org/browse.php?view=0&c2=1&c1=1&c9=1&c11=1&c48=1&c8=1&c18=1&c49=1&c7=1&c38=1&c46=1&c5=1&c13=1&c26=1&c37=1&c19=1&c47=1&c17=1&c4=1&c22=1&c25=1&c20=1&c3=1&search=%tt%&searchtype=0', 'matchRegex': /Nothing found!<\/h2>/, 'TV': true}, { 'name': 'GFT-Gems', 'searchUrl': 'https://www.thegft.org/browse.php?view=1&search=%tt%&searchtype=0', 'matchRegex': /Nothing found!<\/h2>/}, ]; icon_sites = [ { 'name': 'OpenSubtitles', 'icon': 'http://www.opensubtitles.org/favicon.ico', 'searchUrl': "http://www.opensubtitles.org/en/search/imdbid-%tt%"}, { 'name': 'Youtube', 'icon': 'http://www.youtube.com/favicon.ico', 'searchUrl': 'http://www.youtube.com/results?search_query="%search_string%"&search=Search'}, { 'name': 'Rotten Tomatoes', 'icon': "http://www.rottentomatoes.com/favicon.ico", 'searchUrl': "http://www.rottentomatoes.com/alias?type=imdbid&s=%nott%"}, { 'name': 'Criticker', 'icon': 'http://www.criticker.com/favicon.ico', 'searchUrl': 'http://www.criticker.com/?st=movies&h=%search_string%&g=Go'}, { 'name': 'iCheckMovies', 'icon': 'http://www.icheckmovies.com/favicon.ico', 'searchUrl': 'http://www.icheckmovies.com/search/movies/?query=%tt%'}, ]; // Adds search links to an element function add_link(elem,search_url, link_text, strikeout) { var a = $('').attr('href',search_url).attr('target','_blank'); if (strikeout) { a.append($('').append(link_text)); } else { a.append(link_text); } if (!onSearchPage) { // A little bit of trickery to make matches appear first in a list if (strikeout) { $('#pirateheader').append(a).append(' '); } else { $('#piratefound').append(a).append(' '); } } else { var result_box = $(elem).find('td.result_box'); if (result_box.length > 0) { $(result_box).append(a); } else { $(elem).append($('').append(a).addClass('result_box')); } } } // Performs an ajax request to determine whether or not a url should be displayed function maybe_add_link(elem,link_text, search_url, search_fail_match, success_match) { if (typeof(success_match) === 'undefined') success_match = false; GM_xmlhttpRequest({ method: 'GET', url: search_url, onload: function (responseDetails) { if (String(responseDetails.responseText).match(search_fail_match) ? !(success_match) : success_match) { if (onSearchPage ? GM_config.get('strikeout_links_search') : GM_config.get('strikeout_links_movie')) { add_link(elem, search_url, link_text, true); } // If we're on the search page and it isn't found on PTP if (onSearchPage && link_text == 'PTP') { var box = $(elem).find('td.result_box'); if (box.length > 0) { box.css('background-color','green'); } else { $(elem).append($('').css('background-color','green').addClass('result_box')); } } } else { add_link(elem, search_url, link_text, false); } } }); } // Run code to create fields and display sites function perform(elem, movie_id, movie_title) { var tt = 'tt' + movie_id; var nott = movie_id; // Clean up the search string for use in the URL parameters var search_string = movie_title.replace(/ +\(.*/, '').replace(/[^a-zA-Z0-9]/g, ' ').replace(/ +/g, '+'); var is_tv_page = Boolean(document.getElementsByTagName("title")[0].innerHTML.match("TV Series")); // Add area for links on movie page if (!onSearchPage) { var p = $('

').append(GM_config.get('pirate_header_text')).attr('id', 'pirateheader').attr('style', 'font-weight:bold; color:black; background-color: lightgray;'); p.append($('').attr('id', 'piratefound')); $('h1.header:first').parent().append(p); elem = $('#pirateheader'); } $.each(sites, function(index, site) { if (site['show']) { // If we're on a TV page, only show TV links. if (Boolean(site['TV']) == is_tv_page) { searchUrl = site['searchUrl'].replace('%tt%', 'tt'+movie_id) .replace('%nott%', movie_id) .replace('%search_string%', search_string); maybe_add_link(elem, site['name'], searchUrl, site['matchRegex']); } } }); } //------------------------------------------------------ // Button Code //------------------------------------------------------ function display_button() { var p = $('

').attr('id', 'piratebutton'); p.append($('').click(function() { $('#piratebutton').remove(); if (onSearchPage) { performSearch(); } else { movie_title = document.title.match(/^(.*?) \(/)[1]; movie_id = document.URL.match(/\/tt([0-9]+)\//)[1].trim('tt'); addIconBar(); perform(null, movie_id, movie_title); } })); if (onSearchPage) { $('#sidebar').append(p); } else { $('h1.header:first').parent().append(p); } } //------------------------------------------------------ // Icons at top bar //------------------------------------------------------ // Adds a dictionary of icons to the top of the page. // Unlike the other URLs, they aren't checked to see if the movie exists. function addIconBar() { var iconbar = $('h1.header:first'); iconbar.id = 'iconbar'; $.each(icon_sites, function(index, site) { var searchUrl = site['searchUrl'].replace('%tt%', 'tt'+movie_id) .replace('%nott%', movie_id) .replace('%search_string%', movie_title.replace(/ +\(.*/, '').replace(/[^a-zA-Z0-9]/g, ' ').replace(/ +/g, '+')); var image = $('').attr({'style': '-moz-opacity: 0.4;', 'width': '16', 'border': '0', 'src': site['icon'], 'title': site['name']}); var html = $('').append($('').attr('href', searchUrl).addClass('iconbar_icon').append(image)); iconbar.append(html).append(' '); }); if (GM_openInTab) { var aopenall = $("").text("Open All") .attr("href", "javascript:;") .attr('style', 'font-weight:bold;font-size:10px;font-family: Calibri, Verdana, Arial, Helvetica, sans-serif;'); aopenall.click( function () { $('.iconbar_icon').each(function () { GM_openInTab($(this).attr('href')); }); }, false); iconbar.append(aopenall); } } //------------------------------------------------------ // Search page code //------------------------------------------------------ function performSearch(page){ //Perform in search page var styles = '.result_box {width: 335px} .result_box a { margin-right: 5px; color: #444;} '; styles += ' .result_box a:visited { color: red;}'; styles += ' #imdb2leech_tuned {position: fixed; bottom: 10px; right: 10px; z-index: 1000;} '; styles += ' #content-2-wide #main, #content-2-wide .maindetails_center {margin-left: 5px; width: 1001px;} '; GM_addStyle(styles); $('div#main table.results tr.detailed').each(function(){ var link = $(this).find('td.image a'); movie_title = link.html(); movie_id = link.attr('href').match(/tt([0-9]*)\/?$/)[1]; $(this).find('span.genre a').each(function(){ if($(this).html() == "Adult") { $(this).parent().parent().parent().css('background-color','red'); } }); perform($(this), movie_id, movie_title); }); } //------------------------------------------------------ // Code being run (main) //------------------------------------------------------ // Get everything configured // Create the non-site dictionary for GM_config var config_fields = { 'pirate_header_text': { 'label': 'Header text:', 'type': 'text', 'default': 'Pirate this film: ' }, 'load_on_start': { 'label': 'Load on start?', 'type': 'checkbox', 'default': true }, 'strikeout_links_search': { 'label': 'Strike out links on search page?', 'type': 'checkbox', 'default': true }, 'strikeout_links_movie': { 'label': 'Strike out links on movie page?', 'type': 'checkbox', 'default': true }, }; // Sort the sites into a consistent pattern sites.sort(function (a, b) { return a['name'] > b['name']; }); // Add each site GM_config // The GM_config default for checkboxes is false $.each(sites, function(index, site) { config_fields['show_'+site['name']] = { 'label': 'Show '+site['name']+'?', 'type': 'checkbox' } }); // Initialize and register GM_config GM_config.init({ 'id': 'imbd_scout', 'title': 'IMDB Scout Preferences', 'fields': config_fields }); GM_registerMenuCommand('Preferences for IMDB Scout', function() {GM_config.open()}); // Fetch per-site values from GM_config $.each(sites, function(index, site) { site['show'] = GM_config.get('show_'+site['name']); }); // Are we on a search page? // This variable is camelCased to show it's global // Hopefully it can be factored out of the global scope in the future var onSearchPage = Boolean(location.href.match('search')); if (GM_config.get('load_on_start')) { if (!onSearchPage) { var movie_title = document.title.match(/^(.*?) \(/)[1]; var movie_id = document.URL.match(/\/tt([0-9]+)\//)[1].trim('tt'); perform(null, movie_id, movie_title); addIconBar(); } else { performSearch(); } } else { display_button(); }