// ==UserScript==
// @name Kinopoisk+
// @namespace https://greasyfork.org/en/users/899-lain-inverse
// @description Add links to search torrent sites under movie poster
// @include https://kinopoisk.ru/film/*
// @include https://www.kinopoisk.ru/film/*
// @version 2.2
// @grant GM_xmlhttpRequest
// ==/UserScript==
// Script based on script with the same name by https://greasyfork.org/users/3348-xant1k
// Updated to work with CSP and without omdbapi.com which now requires API key
(function(){
'use strict';
let imgs_y = "https://favicon.yandex.net/favicon/";
let imgs_g = "https://plus.google.com/_/favicon?domain=";
let movie_name_block = document.querySelector("span[itemprop='alternativeHeadline']");
if (!movie_name_block) {
console.warn('[K+] Unable to locate movie title.');
return;
}
let movie = movie_name_block.textContent;
if (!movie) {
movie_name_block = document.querySelector(".moviename-big[itemprop='name']");
movie = movie_name_block.textContent;
}
let movie_enc = encodeURIComponent(movie);
let year = document.querySelector('.info a').textContent;
let links = [
//RUSSIAN
'https://rutracker.org/forum/tracker.php?nm=',
'http://kinozal.tv/browse.php?s=',
'http://rutor.info/search/',
'https://nnmclub.to/forum/tracker.php?nm=',
'http://hdclub.org/browse.php?search=',
'http://bluebird-hd.org/browse.php?search=',
//TV SHOW
'https://broadcasthe.net/torrents.php?searchstr=',
'https://www.tvchaosuk.com/all=/browse.php?keywords=',
'https://www.morethan.tv/browse.php?search=',
'http://www.bitmetv.org/browse.php?search=',
'https://tv-vault.me/all=torrents.php?searchstr=',
'https://freshon.tv/browse.php?search=',
//ASIAN
'https://hdchina.club/browse.php?search=',
'https://asiandvdclub.org/all=/browse.php?search=',
'https://hdcorea.me/browse.php?search=',
'https://tp.m-team.cc/browse.php?search=',
'https://totheglory.im/browse.php?search=',
//HD
'https://hdbits.org/all=/browse.php?incldead=0&search=',
'https://scenehd.org/browse.php?search=',
'https://awesome-hd.me/torrents.php?searchstr=',
'https://pixelhd.me/browse.php?search=',
'https://hdme.eu/browse.php?search=',
'https://privatehd.to/browse.php?search=',
'https://uhdbits.org/browse.php?search=',
'https://www.hdarea.co/browse.php?search=',
'https://www.hd-bits.com/browse.php?search=',
'https://hdsky.me/browse.php?search=',
'https://hd-space.org/browse.php?search=',
'https://hdcenter.cc/browse.php?search=',
'http://ultrahdclub.org/browse.php?search=',
'https://hd-torrents.org/browse.php?search=',
'https://beyondhd.xyz/browse.php?search=',
'https://world-in-hd.net/browse.php?search=',
'https://www.bit-hdtv.com/torrents.php?search=',
'https://www.hd-spain.com/browse.php?',
'https://chdbits.co/torrents.php?search=',
//DVD/VHS
'http://www.dvdseed.eu/browse.php?search=',
//SCENE, 0-day
'https://www.torrentday.com/browse.php?search=',
'https://www.thegft.org/browse.php?search=',
'https://sceneaccess.org/browse.php?search=',
'http://piratethe.net/browse.php?search=',
'https://iptorrents.com/all=/t?q=',
'https://tls.passthepopcorn.me/torrents.php?searchstr=',
'https://revolutiontt.me/browse.php?search=',
//OTHER
'https://cinemageddon.net/all=/browse.php?search=',
'https://karagarga.in/all=/browse.php?incldead=1&search=',
'http://www.bitmetv.org/browse.php?search=',
'https://cinematik.net/all=/browse.php?incldead=0&director=0&search=',
'https://x264.me/browse.php?search=',
'https://polishsource.cz/browse.php?search=',
'https://hon3yhd.com/browse.php?search=',
'https://torrentvault.org/browse.php?search=',
'https://torrentshack.me/browse.php?search=',
'https://torrentbytes.net/browse.php?search=',
'https://www.nordicbits.eu/browse.php?search=',
'https://bithumen.be/browse.php?search=',
'https://avistaz.to/browse.php?search=',
'http://www.iloveclassics.com/browse.php?search=',
'http://www.gormogon.com/browse.php?search=',
'http://www.bithq.org/all=/search.php?search=',
'https://tehconnection.eu/browse.php?search=',
'https://horrorcharnel.org/browse.php?search=',
'https://cinemaz.to/browse.php?search=',
'https://danishbits.org/browse.php?search=',
'https://norbits.net/browse.php?search=',
'https://polishtracker.net/browse.php?search=',
'https://privatehd.to/all=/index.php?page=torrents&search=',
//CARTOONS, COMICS
'http://www.cartoonchaos.org/browse.php?search=',
'https://32pag.es/browse.php?search=',
//SUBTITLES
'https://www.opensubtitles.org/browse.php?search=',
'https://subscene.com/browse.php?search=',
'http://www.subtitleseeker.com/browse.php?search=',
//WEB
'http://www.blu-ray.com/search/?quicksearch=1&quicksearch_country=all§ion=bluraymovies&quicksearch_keyword=',
//'https://m.youtube.com/results?ajax=1&tsp=1&q=',
'https://www.youtube.com/results?search_query=',
'https://www.imdb.com/search/title?title='
];
let domain, i = 0;
function reloadFaviconIfBroken(e, domain) {
let status = e.type === 'load' ? 1 : 0;
let img = e.target;
let is_fine = (img.clientWidth > 1 ? 1 : 0) || 0;
if (is_fine)
return;
GM_xmlhttpRequest({
method: 'GET',
url: `${imgs_g}${domain}`,
responseType: 'blob',
onload: res => {
if (res.status !== 200)
return;
let reader = new FileReader();
reader.onload = e => {
img.src = e.target.result.replace('data:;','data:image/png;');
};
reader.readAsDataURL(res.response);
}
});
};
let post = document.createElement('div');
post.className = 'torrents';
let yearStr, eA, eIMG;
for (let link of links) {
if (i === 0)
post.appendChild(document.createElement('br'));
i = i >= 6 ? 0 : i + 1;
domain = link.match(/:\/\/([^/]+)\//)[1];
yearStr = `${domain==='www.imdb.com' ? (year ? `&release_date=${year}-01-01,${year}-12-31` : '') : `%20${year}`}`;
eA = post.appendChild(document.createElement('a'));
eA.target = '_blank';
eA.title = domain.replace(/^www\./,'');
eA.href = `${link}${movie_enc}${yearStr}`;
eIMG = eA.appendChild(document.createElement('img'));
eIMG.src = `${imgs_y}${domain}`;
eIMG.onload = e => reloadFaviconIfBroken(e, '${domain}', 1);
eIMG.onerror = e => reloadFaviconIfBroken(e, '${domain}', 0);
}
let mustsee = document.querySelector('#div_mustsee_main');
if (!mustsee) {
console.warn('[K+] Unable to locate "Must See" block.');
return;
}
mustsee.parentNode.insertBefore(post, mustsee);
let style = document.head.appendChild(document.createElement('style'));
style.sheet.insertRule('.torrents a img { border: 0 }');
let originalPoster = !!document.querySelector('#photoBlock.originalPoster');
style.sheet.insertRule(`.torrents { ${originalPoster ? 'padding-left: 15px;' : ''} margin-top: -20px; margin-bottom: 10px; background-color: #f2f2f2; width: 180px }`);
style.sheet.insertRule(`.torrents a { margin: ${originalPoster ? '4' : '7'}px; display: inline-block; width: 16px; height: 16px; margin-top: 3px; margin-bottom: 3px }`);
})();