// ==UserScript==
// @name auto_feed
// @author tomorrow505
// @thanks 感谢宝大、86大佬、贝壳等大佬提供邀请码;感谢宝大、86大佬提供友情赞助;感谢86大佬、手大、kmeng、黑白、甘蔗等大佬赠予PTP积分.(ID:tomorrow505, 感谢支持)
// @contributor daoshuailx/hollips/kmeng/wyyqyl/shmt86/sauterne
// @description PT一键转种脚本
// @match https://blutopia.cc/torrents?imdb=tt*
// @namespace https://greasyfork.org/zh-CN/scripts/424132-auto-feed
// @match http*://*/*detail*.php*
// @match https://nzbs.in/*
// @match http*://*/detail*.php*
// @match http*://*/upload*php*
// @match https://pixhost.to*
// @match https://*/upload/*
// @match https://*.open.cd/plugin_upload.php*
// @match https://www.myanonamouse.net/t/*
// @match https://img.hdbits.org/
// @match http*://*/offer*php*
// @match http*://*.tieba.baidu.com/*
// @match https://xthor.tk/*
// @match https://house-of-usenet.com/threads/*
// @match https://omgwtfnzbs.org/details*
// @match https://speedapp.io/browse/*
// @match https://desitorrents.tv/torrents*
// @match https://www.imdb.com/title/tt*
// @match https://hdf.world/*
// @match https://broadcity.in/*
// @match https://blutopia.cc/torrents/create*
// @match https://secret-cinema.pw/torrents.php?id=*
// @match https://filelist.io/*
// @match https://bluebird-hd.org/*
// @match https://iptorrents.com/torrent.php?id=*
// @match http*://hd-space.org/index.php?page=torrent-details*
// @match https://digitalcore.club/torrent/*
// @match http*://ptpimg.me*
// @match https://imgbox.com*
// @match https://www.imagebam.com/*
// @match https://totheglory.im/*
// @match https://hd-space.org/index.php?page=upload
// @match https://hdcity.city/upload*
// @match https://hdbits.org/upload*
// @match https://hdbits.org/browse*
// @match https://nebulance.io/torrents.php?id=*
// @match https://hd-only.org/*
// @match https://jpopsuki.eu/torrents.php*
// @match https://passthepopcorn.me/*
// @match https://hd-torrents.org/torrents.php*
// @match https://greatposterwall.com/torrents.php*
// @match https://broadcasthe.net/*.php*
// @match https://backup.landof.tv/*.php*
// @match https://beyond-hd.me/upload*
// @match http*://beyond-hd.me/library/*
// @match https://*/usercp.php?action=personal*
// @match https://uhdbits.org/torrents.php*
// @match https://blutopia.cc/torrents/create/*
// @match https://pt.hdpost.top/upload/*
// @match https://asiancinema.me/upload/*
// @match http*://totheglory.im/t/*
// @match http*://privatehd.to/torrent/*
// @match http*://avistaz.to/torrent/*
// @match http*://cinemaz.to/torrent/*
// @match https://zhuque.in/torrent/*
// @match https://beyond-hd.me/download_check/*
// @match http*://passthepopcorn.me/torrents.php?id*
// @match http*://*php?id=*&torrentid=*
// @match http*://*/*php?id=*&torrentid=*
// @match http*://www.morethantv.me/torrents.php?id=*
// @match https://*php?torrentid=*&id=*
// @match https://hdbits.org/details.php?id=*
// @match https://hdf.world/torrents.php*
// @match http*://beyond-hd.me/torrents/*
// @match https://*.douban.com/subject/*
// @match https://filelist.io/browse.php*
// @match http*://www.torrentleech.org/torrent/*
// @match http*://*/torrents/*
// @match https://*/torrents?imdb*
// @match https://broadcasthe.net/friends.php
// @exclude http*bitpt.cn*
// @match http*://*redacted.ch/upload.php*
// @match http*://*redacted.ch/requests.php*
// @match http*://*redacted.ch/torrents.php*
// @match https://c.pc.qq.com/middlem.html?pfurl=*
// @require https://greasyfork.org/scripts/453166-jquery/code/jquery.js?version=1105525
// @require https://greasyfork.org/scripts/28502-jquery-ui-v1-11-4/code/jQuery%20UI%20-%20v1114.js?version=187735
// @require https://unpkg.com/@popperjs/core@2/dist/umd/popper.min.js
// @require https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js
// @require https://greasyfork.org/scripts/430180-imgcheckbox2/code/imgCheckbox2.js?version=956211
// @require https://greasyfork.org/scripts/444988-music-helper/code/music-helper.js?version=1268106
// @icon https://kp.m-team.cc//favicon.ico
// @run-at document-end
// @version 2.0.5.8
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_download
// @grant GM_getResourceText
// @license GPL-3.0 License
// @grant GM_addStyle
// @downloadURL https://update.greasyfork.icu/scripts/488514/auto_feed.user.js
// @updateURL https://update.greasyfork.icu/scripts/488514/auto_feed.meta.js
// ==/UserScript==
/*
日志:
2022年6月以前的日志请参看:"https://github.com/tomorrow505/auto_feed_js/wiki/更新日志"
20220604:修复海豹部分bug,修复piggo部分bug。优化禁转判断后跳转逻辑。
20220605:新增图片提取功能:https://github.com/tomorrow505/auto_feed_js/wiki/图片处理
20220606:适配BTN另一个网址:https://backup.landof.tv/
20220608:适配PTChina。
20220612:ptgen若无豆瓣词条,可以获取imdb信息。
20220629:适配hdvideo,修复部分bug。
20220705:清洗种子部分内容并且适配外站转种直接发布。
20220706:适配多站发布完之后自动下载种子……(该部分还需要测试)
20220707:修复种子加载之后无效文件名的bug,修复BLU改版引起的bug. 优化洗种逻辑,适配WT-Sakura,冬樱。
20220708:适配支持TVV转出。
20220710:优化皮转入,修复GPW部分bug,简单支持一键签到(测试中)。
20220716:继续完善一键签到。修复部分bug。
20220726:支持MP4/MKV视频文件获取mediainfo+截图。功能待测试(已取消)...https://unpkg.com/auto-feed-media@1.0.1/index.js
20220730:适配MV类型转发,修复部分bug。
20220802:支持转入ITZMX、HDPt(明教),修复1PTBA、3Wmg部分bug。(by shmt86)
20220807:一键签到取消天空和北洋,增加支持妞的转入。具体见教程:https://github.com/tomorrow505/auto_feed_js/wiki/%E8%BD%AC%E8%BD%BD%E5%88%B0BTN
20220808:适配海豚从gz音乐站转入。
20220816:适配azusa by shmt86; 适配OPS/RED从GZ音乐站转入。修复部分bug。
20220820:适配sugoimusic转出,修复部分bug。
20220920:支持HDT备用域名,支持CG转入,待测试。修复部分bug。
20221013:适配monika,修复部分bug。
20221021:适配织梦PT,修复部分bug。
20221103:适配红叶PT。
20221117:修复部分bug,去掉mediainfo和截图功能,鸡肋而且占用体积大。修复没有猫不能进入设置页面的bug。第一次NP站点应该都可以设置。
20221119:适配ICC2022。
20221128:适配DTR/HONE转出。
20230103:修复部分bug。
20230208:稍加完整适配朱雀。
20230413:修复部分bug,去掉一些关闭了的站。
20230511:适配转入 RS (西电睿思)。
20230708:修复部分bug。适配RouSi(by shmt86)。
*/
var site_url = decodeURI(location.href);
const TIMEOUT = 6000;
const N = "\n";
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", false, true);
jQuery.fn.wait = function (func, times, interval) {
var _times = times || 100, //100次
_interval = interval || 20, //20毫秒每次
_self = this,
_selector = this.selector, //选择器
_iIntervalID; //定时器id
if( this.length ){ //如果已经获取到了,就直接执行函数
func && func.call(this);
} else {
_iIntervalID = setInterval(function() {
if(!_times) { //是0就退出
clearInterval(_iIntervalID);
}
_times <= 0 || _times--; //如果是正数就 --
_self = $(_selector); //再次选择
if( _self.length ) { //判断是否取到
func && func.call(_self);
clearInterval(_iIntervalID);
}
}, _interval);
}
return this;
}
var hdb_color = 'black';
if (site_url.match(/^https?:\/\/hdbits.org\/details.php\?id=.*/)) {
hdb_color = GM_getValue('HDB_Color');
if (hdb_color === undefined) {
getDoc('https://hdbits.org/my.php', null, function(doc){
const css = $('input[name="custom_css"]', doc).val();
if (/berlin.css/.test(css)) {
GM_setValue('HDB_Color', 'white');
} else {
GM_setValue('HDB_Color', 'black');
}
});
}
}
GM_addStyle(
`.content th {
font-weight:bold;
color: ${hdb_color};
background-color:transparent;
padding:4px 10px 4px 0;
border:0;
vertical-align:top
}
.content td {
padding:4px 20px 4px 1px
}
.contentlayout {
width:100%
}
.contentlayout td {
border:0;
vertical-align:top
}
.contentlayout h1 {
margin:0 0 14px 15px
}
.contentlayout h3 {
margin:-14px 0 5px 15px;
color:gray
}`
);
/*******************************************************************************************************************
* part 0 简单页面逻辑 *
********************************************************************************************************************/
//修复妞站friend页面两个表列宽不等的问题
if (location.href == 'https://broadcasthe.net/friends.php' || location.href == 'https://backup.landof.tv/friends.php') {
$('.main_column').find('td:contains("Last seen")').css({'width':'150px'});
return;
}
if (location.href == 'https://npupt.com/upload.php'){
return;
}
if (location.href.match(/^.{3,30}userdetail/i) && !site_url.match(/bluebird-hd/) && !site_url.match(/broadcity.in/)) {
return;
}
// 清除PT吧里边的广告
if (location.href.match(/^https?:\/\/.*tieba.baidu.com.*/)) {
document.addEventListener('DOMNodeInserted', function() {
$('div[class*="clearfix"]').wait(function(){
$('div[class="clearfix thread_item_box"]').hide();
$('div[class="l_post l_post_bright j_l_post clearfix"]').has('span:contains("立即查看")').hide();
$('img[data-locate="点击关闭"]').click();
$('#aside-ad').hide();
});
});
return;
}
if (location.href.match(/https:\/\/desitorrents.tv\/torrents/)) {
$('#torrent-list-table').find('tr:gt(0)').map((index,e)=>{
$(e).find('td:eq(2)').find('a.torrent-listings-name').after(`跳转`)
});
}
if (location.href.match(/^https:\/\/zhuque.in\//)) {
document.addEventListener('DOMNodeInserted', function() {
if ($('div.ant-message-notice:contains("欢迎回来")').length && $('div.ant-message-notice:contains("欢迎回来")').is(":visible")) {
$('div.ant-message-notice:contains("欢迎回来")').hide();
}
if ($('div.ant-message-notice:contains("有新的")').length && $('div.ant-message-notice:contains("有新的")').is(":visible")) {
$('div.ant-message-notice:contains("有新的")').hide();
}
if ($('div.banner').length == 2 && $('div.banner:last').is(":visible")) {
$('div.banner:last').hide();
}
});
}
if (site_url.match(/^https:\/\/jptv.club\/torrents\?imdb=\d+/)) {
var imdbno = site_url.match(/imdb=(\d+)/)[1];
$('#imdb').val(imdbno);
getDoc(`https://jptv.club/torrents/filter?imdb=${imdbno}`, null, function(doc){
$('.table-responsive').html($('.table-responsive', doc).html());
});
}
function disableother(select,target){
if(document.getElementById(select).value==0) {
document.getElementById(target).disabled=false;
} else {
document.getElementById(target).disabled=true;
document.getElementById(select).disabled=false;
}
}
function get_group_name(name, torrent_info) {
name = name.replace(/\[.*?\]|web-dl|dts-hd|Blu-ray|MPEG-2|MPEG-4/ig, '');
name = name.split(/\.mkv|\.mp4|\.iso|\.avi/)[0];
if (name.match(/(KJNU|tomorrow505|KG|BMDru|BobDobbs|Dusictv|AFKI)$/i)) {
return name.match(/(KJNU|tomorrow505|KG|BMDru|BobDobbs|Dusictv|AFKI)$/i)[1];
}
try{
tmp_name = name.match(/-(.*)/)[1].split(/-/).pop();
if (tmp_name.match(/AC3|[\. ]DD[\. \+p]|AAC|x264|x265|h.264|h.265|NTSC|PAL|DVD9|DVD5/i)){
if (torrent_info.match(/Scene/)) {
name = name.split('-')[0];
} else {
tmp_name = tmp_name.split(/AC3|[\. ]DD[\. \+p]|AAC|x264|x265|h.264|h.265|NTSC|PAL|DVD9|DVD5/i);
if (tmp_name.length > 1) {
name = tmp_name.pop();
} else {
name = 'Null';
}
}
} else {
name = tmp_name;
}
} catch(err) {
name = name.split(/AC3|[\. ]DD[\. \+p]|AAC|x264|x265|h.264|h.265|NTSC|PAL|DVDRip|DVD9|DVD5/i);
if (name.length > 1) {
name = name.pop();
} else {
name = 'Null';
}
}
name = name.trim();
if (!name || name.match(/\)|^\d\d/)) name = 'Null';
if (name == 'Z0N3') name = 'D-Z0N3';
if (name == 'AVC.ZONE') name = 'ZONE';
if (name.match(/CultFilms/)) name = 'CultFilms™';
if (name.match(/™/) && !name.match(/CultFilms/)) {
name = 'Null';
}
if (name.search('.nfo')) {
name = name.replace('.nfo', '');
}
if (name.match(/[_\.! ]/) || name.match(/Extras/i)) {
name = 'Null';
}
if (name.length == 1 || name.match(/^\d+$/)) {
name = 'Null';
}
return name;
}
if (location.href.match(/^https:\/\/greatposterwall.com\/torrents.php.*/)) {
function get_email(email) {
if (email.length) {
var email_str = "";
var a = email.attr('data-cfemail');
r = parseInt(a.substr(0, 2), 16);
for (j = 2; a.length - j; j += 2) {
c = parseInt(a.substr(j, 2), 16) ^ r;
email_str += String.fromCharCode(c);
}
email.replaceWith(`${email_str}`);
}
}
if (location.href.match(/id=\d+/)) {
var number = parseInt($('tr.TableTorrent-rowDetail').length / 2);
$(`tr.TableTorrent-rowDetail:lt(${number+1})`).each((index, e)=>{
var tid = $(e).attr('id').match(/\d+/)[0];
var torrent_name = $(e).find('a:contains(详情)').parent().text().split('详情 | ')[1];
var torrent_info = $(e).prev().find('td').text();
torrent_name = get_group_name(torrent_name, torrent_info);
if (torrent_name == 'Unknown' && torrent_info.match(/Blu-ray/)) {
show_files(tid, 'detail');
$(e).find('table[class="TableTorrentFileList Table"]').wait(function(){
var torrent_td = $(e).find('table[class="TableTorrentFileList Table"]').find('tr:first').find('td:first');
torrent_name = torrent_td.text().replace(/\//g, '');
torrent_name = get_group_name(torrent_name, torrent_info);
$(`#torrent${tid}`).find('span.TorrentTitle ').append(`/${torrent_name}`);
show_files(tid, 'detail');
});
} else {
$(e).prev().find('span.TorrentTitle ').append(`/${torrent_name}`);
}
});
} else {
$('td.is-name[colspan="3"]').each((index,e)=>{
var torrent = $(e).find('a[href*="torrentid"]');
var torrent_name = torrent.attr('data-tooltip');
torrent_name = get_group_name(torrent_name, '');
torrent.append(` / ${torrent_name}`);
})
}
}
// 解决qq打开链接非官方不跳转的问题
if (location.href.match(/^https:\/\/c.pc.qq.com\/middlem.html\?pfurl=.*/)) {
var url = decodeURIComponent(location.href).match(/pfurl=(.*?)&pf/)[1];
window.location.href = url;
return;
}
if (location.href.match(/^https:\/\/filelist.io\/browse.php/)) {
$('input[name="search"]').attr('placeholder', 'Search by key-word or IMDB...');
$('input[type="submit"]').attr('value', 'Go!');
$('input[onclick*=catlist]').attr('value', 'Category');
$('select[name="searchin"]').find('option:eq(0)').text('Name and Description');
$('select[name="searchin"]').find('option:eq(1)').text('Name');
$('select[name="searchin"]').find('option:eq(2)').text('Description');
$('select[name="cat"]').find('option:eq(21)').text('Series 4K');
$('select[name="cat"]').find('option:eq(22)').text('Series HD');
$('select[name="cat"]').find('option:eq(23)').text('Series SD');
$('select[name="sort"]').find('option:eq(1)').text('Relevante');
$('select[name="sort"]').find('option:eq(3)').text('Size');
var dict_info = {
'toate': 'Total',
'Anime': 'Animates',
'Desene': 'Drawings',
'Diverse': 'Other',
'Filme': 'Film',
'Jocuri Console': 'Console Games',
'Jocuri PC': 'PC Games',
'Seriale': 'Series'
}
$('input[name="cats[]"]').map((index, e)=>{
var category = $(e).parent().find('a').text();
for (key in dict_info) {
category = category.replace(key, dict_info[key]);
}
$(e).parent().find('a').text(category);
});
$('select[name="cat"]').find('option').map((index, e)=>{
var category = $(e).text();
for (key in dict_info) {
category = category.replace(key, dict_info[key]);
}
$(e).text(category);
});
return;
}
function getFiletype(file) {
if (file == 'jpg') {
file = 'jpeg'
}
return 'image/' + file;
}
function getImage(url) {
var p = new Promise(function(resolve, reject) {
var filetype = getFiletype(url.match(/\.(jpg|jpeg|webp|png)$/)[1]);
var name = url.split('/').pop();
getBlob(url, null, null, filetype, function(data){
const blob = data.data;
const file = new window.File([blob], name, { type: blob.type });
resolve(file);
});
});
return p;
}
//获取ptpimg的apikey自动的
if (site_url.match(/^https?:\/\/ptpimg.me/)) {
var s=document.createElement('span');
document.body.appendChild(s);
s.setAttribute('style', 'text-align: center; width: 100%; display: inline-block;');
s.innerHTML = 'API Key: ' + document.getElementById('api_key').value;
if (!used_ptp_img_key) {
used_ptp_img_key = document.getElementById('api_key').value;
GM_setValue('used_ptp_img_key', used_ptp_img_key);
}
var images = GM_getValue('HDB_images') !== undefined ? GM_getValue('HDB_images').split(', '): '';
if (images) {
if (!images[images.length-1].match(/^http/)) {
images.pop();
}
$('div.jumbotron > center').append(``);
$('#add_images').click(()=>{
console.log(images);
$('#add_images').val("拉取中……");
let container = new DataTransfer();
var pros = [];
images.map((item)=>{
var p = getImage(item);
pros.push(p);
});
Promise.all(pros).then((data)=>{
data.forEach((i)=>{
container.items.add(i);
});
$('input[name="file-upload[]"]')[0].files = container.files;
$('#add_images').val("拉取成功!");
});
});
}
return;
}
if (site_url.match(/^https?:\/\/.*(imgbox.com|imagebam.co|pixhost.to|img.hdbits.org).?$/)) {
var images = GM_getValue('HDB_images') !== undefined ? GM_getValue('HDB_images').split(', '): '';
if (images && $('input[name="files[]"]').length) {
$('div.visible-desktop:first').find('span:first').append(`
`);
$('#add_images').click(()=>{
$('#add_images').val("拉取中……");
var gallary_name = images.pop();
let container = new DataTransfer();
var pros = [];
images.map((item)=>{
console.log(item)
if (item.match(/t.hdbits.org/)) {
item = item.replace('t.hdbits.org', 'i.hdbits.org').replace('jpg', 'png');
}
if (item.match(/jpg|png/)) {
var p = getImage(item);
pros.push(p);
}
});
Promise.all(pros).then((data)=>{
data.forEach((i)=>{
container.items.add(i);
});
$('input[name="files[]"]')[0].files = container.files;
$('input[name="files[]"]')[0].dispatchEvent(evt);
$('#gallery-title').val(gallary_name);
$('#add_images').val("拉取成功!");
});
});
}
if (site_url.match(/pixhost.to|img.hdbits.org/)) {
if (images.length && images[0]) {
$('div.logo').append(`
`);
$('#header').after(`
`);
}
$('#add_images').click(()=>{
$('#add_images').val("拉取中……");
var gallary_name = images.pop();
let container = new DataTransfer();
var pros = [];
images.map((item)=>{
if (item.match(/t.hdbits.org/)) {
item = item.replace('t.hdbits.org', 'i.hdbits.org').replace('jpg', 'png');
}
console.log(item)
if (item.match(/jpg|png/)) {
var p = getImage(item);
pros.push(p);
}
});
Promise.all(pros).then((data)=>{
data.forEach((i)=>{
container.items.add(i);
});
$('input[type="file"]')[0].files = container.files;
$('input[type="file"]')[0].dispatchEvent(evt);
if (site_url.match(/pixhost/)){
$('input.max_th_size').val('350');
$('input.max_th_size')[0].dispatchEvent(evt);
$('#gallery_box').attr('checked', true);
$('#gallery_box')[0].dispatchEvent(evt);
$('input[name="gallery_name"]').val(gallary_name);
} else {
$('#thumbsize').val('w350');
$('#galleryname').val(gallary_name);
}
$('#add_images').val("拉取成功!");
GM_setValue('HDB_images', '');
});
});
}
var imgs_64 = GM_getValue('64imgs') !== undefined ? JSON.parse(GM_getValue('64imgs')): [];
if (imgs_64.length) {
function b64toBlob(b64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, {type: contentType});
return blob;
}
if (site_url.match(/imgbox/)) {
$('div.visible-desktop:first').find('span:first').append(`
`);
} else {
$('div.main-content').after(`
`);
}
$('#add_64images').click(()=>{
var gallary_name = imgs_64.pop();
let container = new DataTransfer();
imgs_64.forEach((item, index)=>{
console.log(item)
var blob = b64toBlob(item.replace('data:image/png;base64,', ''), 'image/png');
const file = new window.File([blob], `thumbnail-${index}.png`, { type: blob.type });
container.items.add(file);
});
if (site_url.match(/imgbox/)) {
$('input[name="files[]"]')[0].files = container.files;
$('input[name="files[]"]')[0].dispatchEvent(evt);
$('#gallery-title').val(gallary_name);
} else {
$('input[class="dz-hidden-input"]')[0].files = container.files;
$('input[class="dz-hidden-input"')[0].dispatchEvent(evt);
$('input[value="sfw"]').attr('checked', true);
$('#gallery').attr('checked', true);
$('#gallery')[0].dispatchEvent(evt);
$('#thumbnail-size').val(4);
$('#gallery-title').val(gallary_name);
}
});
}
return;
}
if (site_url.match(/^https?:\/\/passthepopcorn.me.*/)) {
$('div.main-menu').find('ul').append(`Free`);
}
if (site_url.match(/^https:\/\/hdf\.world\/.*/)) {
var menu_html = $('#header').html();
menu_html = menu_html.replace(/Accueil/, 'Homepage');
menu_html = menu_html.replace(/Requêtes/, 'Requests');
menu_html = menu_html.replace(/Règles/, 'Rules');
menu_html = menu_html.replace(/Acteurs\/Réal\/Product/g, 'Actors/Real/Product');
menu_html = menu_html.replace(/Journaux/g, 'Newspapers');
menu_html = menu_html.replace(/Membres/g, 'Members');
menu_html = menu_html.replace(/Jetons FL/g, 'FL Tokens');
menu_html = menu_html.replace(/Messagerie/g, 'Messaging');
menu_html = menu_html.replace(/Mes ups/g, 'My Uploads');
menu_html = menu_html.replace(/Signets/g, 'Bookmarks');
menu_html = menu_html.replace(/Abonnements/g, 'Subscriptions');
menu_html = menu_html.replace(/Editer/g, 'Edit');
menu_html = menu_html.replace(/Déconnexion/g, 'Logout');
menu_html = menu_html.replace(/Dons reçu/g, 'Donations received');
menu_html = menu_html.replace(/Uploader/g, 'Upload');
menu_html = menu_html.replace(/Envoyé/g, 'Uploaded');
menu_html = menu_html.replace(/Reçu/g, 'Downloaded');
menu_html = menu_html.replace(/Requis/g, 'Required');
menu_html = menu_html.replace(/Envoyé/g, 'Uploaded');
menu_html = menu_html.replace(/Reçu/g, 'Downloaded');
$('#header').html(menu_html);
}
//用于修改hdf的显示样式,不喜欢可以删除或者注释掉
if (site_url.match(/^https:\/\/hdf\.world\/torrents\.php/i) && !site_url.match(/torrentid/i)){
$('.team_name').each(function(){
var $span = $(this).parent().next();
$span.find('a:eq(1)').append(" / --");
try{
if ($span.find('a:eq(1)').html().match(/Free/)){
$span.parent().css({'border-right': '5px solid yellow'});
}
} catch(err){}
$(this).html(`${$(this).html()}`);
$span.find('a:eq(1)').append($(this));
});
$('.group_torrent').each(function(){
try{
$(this).find('td:eq(1)').css({"vertical-align": "middle", "text-align":"center"});
$(this).find('td:eq(0)').find('a:eq(0)').text('DL');
$(this).find('td:eq(0)').find('a:eq(2)').text('RP');
var text = $(this).find('td:eq(2)').html();
text = text.replace('ans', 'years').replace('mois', 'month').replace('heure', 'hour').replace('jour', 'day').replace('semaine', 'week').replace('1 an', '1 year');
$(this).find('td:eq(2)').html(text);
} catch (err) {}
});
$('.group').each(function(){
$(this).find('td').css({"border-top": "2px solid darkgrey"});
$(this).find('td:lt(2)').remove();
$(this).find('td:eq(0)').attr("colSpan", "4");
var text = $(this).find('td:eq(1)').html();
text = text.replace('ans', 'years').replace('mois', 'month').replace('heure', 'hour').replace('jour', 'day').replace('semaine', 'week').replace('1 an', '1 year');
$(this).find('td:eq(1)').html(text);
$(this).find('td:eq(1)').css({"text-align":"right"});
$(this).find('a[id*="bookmarklink_torrent"]').text('Bookmark')
});
$('.head:gt(2)').hide();
$('.head:eq(2)').find('strong').text('Research');
$('#ft_basic_link').find('font:first').text('Basic');
$('#ft_basic_text').find('font:first').text('Basic');
$('#ft_advanced_link').find('font').text('Advanced');
$('#ft_advanced_text').find('font').text('Advanced');
$('#nav_logout').find('a').text('Logout');
$('#nav_upload').find('a').text('Upload');
$('#nav_donate').find('a').text('Donate');
$('#stats_seeding').find('a').text('Uploaded');
$('#stats_leeching').find('a').text('Downloaded');
return;
}
//处理blutopia和hdpost跳转检索,因为其使用ajax异步检索
if (site_url.match(/(blutopia.cc|pt.hdpost.top|asiancinema.me|hd-olimpo.club|aither.cc|cinematik.net)\/torrents\?imdb(id)?=.*/)){
if (site_url.match(/blutopia.cc/i)) {
$('div.form-group:contains(IMDb)').find('input').val(site_url.split('=')[1].split('&')[0]);
$('button.btn-primary:contains(Advanced)').click();
$('div.form-group:contains(IMDb)').find('input').focus();
} else {
$('#imdb').val(site_url.split('=')[1].split('#')[0]);
}
return;
}
//处理ptgen跳转,基本上使用频率很少了,不过还是可以在内站作为豆瓣信息不全的时候使用
if (site_url.match(/^https:\/\/api.iyuu.cn\/ptgen\/\?imdb=/)){
url = site_url.split('=')[1];
if (url.match(/tt/i)){
req = 'https://movie.douban.com/j/subject_suggest?q=' + url;
GM_xmlhttpRequest({
method: 'GET',
url: req,
onload: function(res) {
var response = JSON.parse(res.responseText);
if (response.length > 0) {
url = 'https://movie.douban.com/subject/' + response[0].id;
} else {
url = 'https://www.imdb.com/title/' + url;
}
document.getElementById('input_value').value = url;
document.getElementById('query_btn').click();
}
});
} else {
url = 'https://movie.douban.com/subject/' + url + '/';
document.getElementById('input_value').value = url;
document.getElementById('query_btn').click();
}
return;
}
if (site_url.match(/^https:\/\/passthepopcorn.me\/torrents.php\?id=\d+&torrentid=\d+#seperator#/)) {
var tid = site_url.match(/torrentid=(\d+)/)[1];
window.open($(`a[href*="action=download&id=${tid}"]`).attr('href'), '_blank');
}
if (site_url.match(/^https:\/\/(blutopia.cc|pt.hdpost.top|asiancinema.me|hd-olimpo.club)\/torrents\/download_check/)) {
window.open($('a[href*="torrents/download"]').has('i').attr('href'), '_blank');
return;
}
if (site_url.match(/^https:\/\/totheglory.im\/details.php\?id=\d+&uploaded=1/)) {
window.open($('a.index:contains(".torrent")').attr("href"), '_blank');
}
if (site_url.match(/^https:\/\/broadcasthe.net\/torrents.php\?id=\d+$/)) {
if ($('a[href*="action=edit"]').length) {
$('tr').has('a[href*="action=edit"]').map((index,e)=>{
if ($(e).find('td:eq(3)').text() == '0'){
window.open($(e).find('a[href*="action=download"]').attr('href'), '_blank');
}
});
}
}
if (site_url.match(/^https:\/\/kp.m-team.cc\/details.php\?id=\d+&uploaded=1/)) {
window.open($('a[href*="download.php?id="]').attr("href"), '_blank');
return;
}
if (site_url.match(/^https:\/\/www.morethantv.me\/torrents.php\?id=\d+#seperator#/)) {
var user_page = 'https://www.morethantv.me' + $('#nav_userinfo').find('a:first').attr('href');
getDoc(user_page, null, function(doc){
var turl = $('#torrentsdiv', doc).find('tr:eq(1)').find('td:eq(1)').find('a').attr('href');
var tid = turl.match(/torrentid=(\d+)/)[1];
var durl = $(`a[href*="action=download&id=${tid}"]`).attr('href');
window.open(durl, '_blank');
return;
});
}
if (site_url.match(/^https:\/\/secret-cinema.pw\/torrents.php\?id=\d+#seperator#/)) {
var user_page = $('#nav_userinfo').find('a:first').attr('href');
$('#torrent_details').find('tr[class*=torrentdetails]').map((index,e)=>{
if ($(e).find(`a[href*="${user_page}"]`).length) {
if ($(e).find('span[class="time tooltip"]').text().match(/^(\d+ mins? ago|Just now)/)) {
tid = $(e).attr('id').match(/\d+/)[0];
var durl = $(`a[href*="action=download&id=${tid}"]`).attr('href');
window.open(durl, '_blank');
}
}
});
}
if (site_url.match(/^https:\/\/uhdbits.org\/torrents.php\?id=\d+#seperator#/)) {
var user_page = $('#nav_userinfo').find('a:first').attr('href');
$('#torrent_details').find('tr[class*=torrentdetails]').map((index,e)=>{
if ($(e).find(`a[href*="${user_page}"]`).length) {
if ($(e).find('span[class="time tooltip"]').text().match(/^(\d+ mins?|Just now)/)) {
tid = $(e).attr('id').match(/\d+/)[0];
var durl = $(`a[href*="action=download&id=${tid}"]`).attr('href');
window.open(durl, '_blank');
}
}
});
}
if (site_url.match(/^https:\/\/(privatehd|avistaz|cinemaz).to\/torrent\/\d+/)) {
if ($('strong:contains(There are possible issues with the torrent)').length) {
var tid = site_url.match(/torrent\/(\d+)/)[1];
var turl = $(`a[href*="download/torrent/${tid}"]`).attr('href');
window.open(turl, '_blank');
}
}
if (site_url.match(/^https:\/\/hd-torrents.org\/upload.php#seperator#/)) {
if ($('td:contains(Upload successful! The torrent has been added.)').length) {
window.open($('a[href*="download.php?id"]').attr('href'), '_blank');
return;
}
}
if (site_url.match(/https:\/\/hd-space.org\/index.php\?page=upload/)) {
if ($('td:contains(Upload successful! The torrent has been added.)').length) {
window.open($('a[href*="download.php?id"]').attr('href'), '_blank');
return;
}
}
if (site_url.match(/^https:\/\/beyond-hd.me\/download_check\//)) {
window.open($('a[href*="beyond-hd.me/download"]').has('i').attr('href'), '_blank');
return;
}
if (site_url.match(/^https:\/\/hdbits.org\/details.php\?id=\d+&uploaded=1/)) {
window.open($('a[href*="/download.php/"]').attr('href'), '_blank');
return;
}
if (site_url.match(/^https:\/\/karagarga.in\/details.php\?id=\d+&uploaded=1/)) {
window.open($('a[href*="/down.php/"]').attr('href'), '_blank');
return;
}
if (site_url.match(/^https:\/\/nebulance.io\/torrents.php\?id=\d+#seperator#/)) {
window.open($('a[href*="action=download&id"]:contains(Download)').attr('href'), '_blank');
return;
}
/*******************************************************************************************************************
* part 1 变量初始化层 *
********************************************************************************************************************/
//提供可用的获取豆瓣信息两个api,从0-1选择。主要应用于外站,另一个是自动爬取豆瓣页面
const apis = ['https://api.iyuu.cn/App.Movie.Ptgen', 'https://ptgen.tju.pt/infogen'];
var api_chosen = GM_getValue('api_chosen') === undefined ? 3: GM_getValue('api_chosen');
var imdb2db_chosen = GM_getValue('imdb2db_chosen') === undefined ? 0: GM_getValue('imdb2db_chosen');
/*
* 设置依托站点,可以选择【PTer/HDDolby/CMCT/PThome/OurBits/TCCF/TJUPT】
* 实在打不开可以打开以上站点个人设置页面加#setting, 如:https://springsunday.net/usercp.php?action=personal#setting
*/
// const default_setting_host = 'PTer';
var setting_host = GM_getValue('setting_host') === undefined ? null: GM_getValue('setting_host');
if (['HDChina', 'HHClub'].indexOf(setting_host) > -1) {
setting_host = null;
}
//用来转存海报使用的ptpimg的key,打开首页即可获取
var used_ptp_img_key = GM_getValue('used_ptp_img_key') === undefined ? '': GM_getValue('used_ptp_img_key');
//用来获取TMDB的key,需要使用请自行申请
var used_tmdb_key = GM_getValue('used_tmdb_key') === undefined ? '0f79586eb9d92afa2b7266f7928b055c': GM_getValue('used_tmdb_key');
//是否匿名,默认开启匿名选项
var if_uplver = GM_getValue('if_uplver') === undefined ? 1: GM_getValue('if_uplver');
var if_douban_jump = GM_getValue('if_douban_jump') === undefined ? 1: GM_getValue('if_douban_jump');
var if_imdb_jump = GM_getValue('if_imdb_jump') === undefined ? 1: GM_getValue('if_imdb_jump');
//额外的功能选项
const default_extra_settings = {
'ptp_show_douban': {'title': 'PTP中文', 'enable': 1},
'ptp_show_group_name': {'title': 'PTP组名', 'enable': 1},
'hdb_show_douban': {'title': 'HDB中文', 'enable': 1},
'hdb_show_discount_color': {'title': 'HDB折扣', 'enable': 1},
'btn_dark_color': {'title': '妞暗色系', 'enable': 1},
'other_douban_info': {'title': '中文信息', 'enable': 1},
};
var extra_settings = GM_getValue('extra_settings') === undefined ? default_extra_settings : JSON.parse(GM_getValue('extra_settings'));
if (!extra_settings.hasOwnProperty('btn_dark_color')) {
extra_settings = default_extra_settings;
}
if (!extra_settings.hasOwnProperty('other_douban_info')) {
extra_settings.other_douban_info = default_extra_settings.other_douban_info;
}
const all_sites_show_douban = extra_settings.other_douban_info.enable;
var hdb_hide_douban = GM_getValue('hdb_hide_douban') === undefined ? 0: GM_getValue('hdb_hide_douban');
//0表示前边,1表示后边
var ptp_name_location = GM_getValue('ptp_name_location') === undefined ? 1 : GM_getValue('ptp_name_location');
//支持转发的站点列表,可以自行取消注释
const default_site_info = {
'1PTBA': {'url': 'https://1ptba.com/', 'enable': 1},
'3Wmg': {'url': 'https://www.3wmg.com/', 'enable': 1},
'52PT': {'url': 'https://52pt.site/', 'enable': 1},
'ACM': {'url': 'https://asiancinema.me/', 'enable': 1},
'ANT': {'url': 'https://anthelion.me/', 'enable': 1},
'AZUSA': {'url': 'https://azusa.wiki/', 'enable': 1},
'avz': {'url': 'https://avistaz.to/', 'enable': 1},
'Audiences': {'url': 'https://audiences.me/', 'enable': 1},
'BHD' : {'url': 'https://beyond-hd.me/', 'enable': 1},
'Aither': {'url': 'https://aither.cc/', 'enable': 1},
'BLU': {'url': 'https://blutopia.cc/', 'enable': 1},
'BTN': {'url': 'https://broadcasthe.net/', 'enable': 1},
'BYR': {'url': 'https://byr.pt/', 'enable': 1},
'BTSchool': {'url': 'https://pt.btschool.club/', 'enable': 1},
'CarPt': {'url': 'https://carpt.net/', 'enable': 1},
'CG': {'url': 'http://cinemageddon.net/', 'enable': 1},
'CMCT': {'url': "https://springsunday.net/", 'enable': 1},
'CNZ': {'url': 'https://cinemaz.to/', 'enable': 1},
'CHDBits': {'url': "https://ptchdbits.co/", 'enable': 1},
'DaJiao': {'url': 'https://dajiao.cyou/', 'enable': 1},
'DiscFan': {'url': 'https://discfan.net/', 'enable': 1},
'Dragon': {'url': 'https://www.dragonhd.xyz/', 'enable': 1},
'FreeFarm': {'url': 'https://pt.0ff.cc/', 'enable': 1},
'GPW': {'url': 'https://greatposterwall.com/', 'enable': 1},
'HaiDan': {'url': 'https://www.haidan.video/', 'enable': 1},
'HaresClub': {'url': 'https://club.hares.top/', 'enable': 1},
'HD4FANS': {'url': 'https://pt.hd4fans.org/', 'enable': 1},
'HDArea': {'url': 'https://hdarea.club/', 'enable': 1},
'HDAtmos': {'url': 'https://hdatmos.club/', 'enable': 1},
'HDB': {'url': 'https://hdbits.org/', 'enable': 1},
'HDChina': {'url': "https://hdchina.org/", 'enable': 1},
'HDCity': {'url': 'https://hdcity.city/', 'enable': 1},
'HDDolby': {'url': 'https://www.hddolby.com/', 'enable': 1},
'HDF': {'url': 'https://hdf.world/', 'enable': 1},
'HDfans': {'url': 'http://hdfans.org/', 'enable': 1},
'HDHome': {'url': 'https://hdhome.org/', 'enable': 1},
'HDMaYi': {'url': 'http://hdmayi.com/', 'enable': 1},
'HDPost': {'url': 'https://pt.hdpost.top/', 'enable': 1},
'HDRoute': {'url': 'http://hdroute.org/', 'enable': 1},
'HDSky': {'url': 'https://hdsky.me/', 'enable': 1},
'HDSpace': {'url': 'https://hd-space.org/', 'enable': 1},
'HDT': {'url': 'https://hd-torrents.org/', 'enable': 1},
'HDTime': {'url': 'https://hdtime.org/', 'enable': 1},
'HDU': {'url': 'https://pt.hdupt.com/', 'enable': 1},
'HDVideo': {'url': 'https://hdvideo.one/', 'enable': 1},
'HDZone': {'url': 'https://hdfun.me/', 'enable': 1},
'HD-Only': {'url': 'https://hd-only.org/', 'enable': 1},
'HHClub': {'url': 'https://hhanclub.top/', 'enable': 1},
'HITPT': {'url': 'https://www.hitpt.com/', 'enable': 1},
'HUDBT': {'url': 'https://hudbt.hust.edu.cn/', 'enable': 1},
'iTS': {'url': 'https://shadowthein.net/', 'enable': 1},
'JoyHD': {'url': 'https://www.joyhd.net/', 'enable': 1},
'KG': {'url': 'https://karagarga.in/', 'enable': 1},
'MTeam': {'url': 'https://kp.m-team.cc/', 'enable': 1},
'MTV': {'url': 'https://www.morethantv.me/', 'enable': 1},
'NanYang': {'url': 'https://nanyangpt.com/', 'enable': 1},
'NBL': {'url': 'https://nebulance.io/', 'enable': 1},
'NPUPT': {'url': 'https://npupt.com/', 'enable': 1},
'OpenCD': {'url': 'https://open.cd/', 'enable': 1},
'OPS': {'url': 'https://orpheus.network/', 'enable': 1},
'Oshen': {'url': 'http://www.oshen.win/', 'enable': 1},
'OurBits': {'url': 'https://ourbits.club/', 'enable': 1},
'PHD': {'url': 'https://privatehd.to/', 'enable': 1},
'PigGo': {'url': 'https://piggo.me/', 'enable': 1},
'PTCafe': {'url': 'https://ptcafe.club/', 'enable': 1},
'PTChina': {'url': 'https://ptchina.org/', 'enable': 1},
'PTer': {'url': 'https://pterclub.com/', 'enable': 1},
'PThome': {'url': 'https://www.pthome.net/', 'enable': 1},
'PTP': {'url': 'https://passthepopcorn.me/', 'enable': 1},
'PTsbao': {'url': 'https://ptsbao.club/', 'enable': 1},
'PTT': {'url': 'https://www.pttime.org/', 'enable': 1},
'PuTao': {'url': 'https://pt.sjtu.edu.cn/', 'enable': 1},
'RED': {'url': 'https://redacted.ch/', 'enable': 1},
'SC': {'url': 'https://secret-cinema.pw/', 'enable': 1},
'SoulVoice': {'url': 'https://pt.soulvoice.club/', 'enable': 1},
'TCCF': {'url': 'https://et8.org/', 'enable': 1},
'Tik': {'url': 'https://cinematik.net/', 'enable': 1},
'TJUPT': {'url': 'https://www.tjupt.org/', 'enable': 1},
'TLFbits': {'url': 'http://pt.eastgame.org/', 'enable': 1},
'TTG': {'url': 'https://totheglory.im/', 'enable': 1},
'TVV': {'url': 'http://tv-vault.me/', 'enable': 1},
'UHD': {'url': 'https://uhdbits.org/', 'enable': 1},
'UltraHD': {'url': 'https://ultrahd.net/', 'enable': 1},
'WT-Sakura': {'url': 'https://wintersakura.net/', 'enable': 1},
'xthor': {'url': 'https://xthor.tk/', 'enable': 1},
'YDY': {'url': 'https://pt.hdbd.us/', 'enable': 1},
'ITZMX': {'url': 'https://pt.itzmx.com/', 'enable': 1},
'HDPt': {'url': 'https://hdpt.xyz/', 'enable': 1},
'JPTV': {'url': 'https://jptv.club/', 'enable': 1},
'Monika': {'url': 'https://monikadesign.uk/', 'enable': 1},
'ZMPT': {'url': 'https://zmpt.cc/', 'enable': 1},
'红叶': {'url': 'https://leaves.red/', 'enable': 1},
'ICC': {'url': 'https://www.icc2022.com/', 'enable': 1},
'CyanBug': {'url': 'https://cyanbug.net/', 'enable': 1},
'SharkPT': {'url': 'https://sharkpt.net/', 'enable': 1},
'2xFree': {'url': 'https://pt.2xfree.org/', 'enable': 1},
'ZHUQUE': {'url': 'https://zhuque.in/', 'enable': 1},
'海棠': {'url': 'https://www.htpt.cc/', 'enable': 1},
'杏林': {'url': 'https://xingtan.one/', 'enable': 1},
'SRVFI': {'url': 'https://srvfi.top/', 'enable': 1},
'UBits': {'url': 'https://ubits.club/', 'enable': 1},
'OKPT': {'url': 'https://www.okpt.net/', 'enable': 1},
'XHB': {'url': 'https://pt.837576.xyz/', 'enable': 1},
'GGPT': {'url': 'https://www.gamegamept.com/', 'enable': 1},
'RS': {'url': 'https://resource.xidian.edu.cn/', 'enable': 1},
'Panda': {'url': 'https://pandapt.net/', 'enable': 1},
'KuFei': {'url': 'https://kufei.org/', 'enable': 1},
'RouSi': {'url': 'https://rousi.zip/', 'enable': 1},
'悟空': {'url': 'https://wukongwendao.top/', 'enable': 1},
'PTLSP': {'url': 'https://www.ptlsp.com/', 'enable': 1},
'GTK': {'url': 'https://pt.gtk.pw/', 'enable': 1},
'象站': {'url': 'https://ptvicomo.net/', 'enable': 1},
'麒麟': {'url': 'https://www.hdkyl.in/', 'enable': 1},
'Agsv': {'url': 'https://www.agsvpt.com/', 'enable': 1},
'KIMOJI': {'url': 'https://kimoji.club/', 'enable': 1},
'ECUST': {'url': 'https://public.ecustpt.eu.org/', 'enable': 1},
'iloli': {'url': 'https://share.ilolicon.com/', 'enable': 1}
};
var chd_use_backup_url = GM_getValue('chd_use_backup_url') === undefined ? 0: GM_getValue('chd_use_backup_url');
if (chd_use_backup_url) {
var region_code = GM_getValue('region_code');
if (region_code) {
default_site_info.CHDBits.url = `https://${region_code}.chddiy.xyz/`;
} else {
fetch('https://ipapi.co/json/') // 发送GET请求到ipapi
.then(response => response.json()) // 解析响应的JSON数据
.then(data => {
region_code = data.region_code.toLowerCase();
GM_setValue('region_code', region_code);
})
.catch(error => {
console.log("发生错误: " + error);
}
);
}
}
//初始化数据site_order/used_site_info等等
var site_order = GM_getValue('site_order') === undefined ? Object.keys(default_site_info).sort(): JSON.parse(GM_getValue('site_order')).split(',');
var used_site_info = GM_getValue('used_site_info');
var if_new_site_added = false;
if (used_site_info === undefined) {
used_site_info = default_site_info;
GM_setValue('used_site_info', JSON.stringify(used_site_info));
} else {
//预防有新加的站点没有加上的。
used_site_info = JSON.parse(used_site_info);
for (key in default_site_info) {
if (!used_site_info.hasOwnProperty(key)) {
used_site_info[key] = default_site_info[key];
if_new_site_added = true;
} else if (default_site_info[key].url != used_site_info[key].url && key != 'Agsv') {
used_site_info[key].url = default_site_info[key].url
}
if (site_order.indexOf(key) < 0) {
site_order.push(key);
}
}
for (key in used_site_info) {
if (!default_site_info.hasOwnProperty(key)) {
delete used_site_info[key];
if (site_order.indexOf(key) >= 0) {
site_order = site_order.filter(function(item) {
return item != key;
});
}
if_new_site_added = true;
}
}
site_order = site_order.filter(function(item){
if (!default_site_info.hasOwnProperty(item)) {
return false;
} else {
return true;
}
});
}
if (if_new_site_added) {
GM_setValue('used_site_info', JSON.stringify(used_site_info));
GM_setValue('site_order', JSON.stringify(site_order.join(',')));
}
// 修正北洋、铂金和皇后有www和不带www两个域名。
if (site_url.match(/^http(s)?:\/\/(www.)?(tjupt.org|open.cd|pthome.net)\//)) {
var site_domain = site_url.match(/^http(s)?:\/\/(www.)?(tjupt.org|open.cd|pthome.net)\//)[0];
if (site_domain.match(/tjupt/)) {
used_site_info.TJUPT.url = site_domain;
} else if (site_domain.match(/pthome/)) {
used_site_info.PThome.url = site_domain;
} else {
used_site_info.OpenCD.url = site_domain;
}
GM_setValue('used_site_info', JSON.stringify(used_site_info));
}
if (site_url.match(/^https:\/\/hdts.ru\/.*/)) {
used_site_info.HDT.url = 'https://hdts.ru/';
GM_setValue('used_site_info', JSON.stringify(used_site_info));
} else if (site_url.match(/^https:\/\/hd-torrents.org\/.*/)) {
used_site_info.HDT.url = 'https://hd-torrents.org/';
GM_setValue('used_site_info', JSON.stringify(used_site_info));
}
if (site_url.match(/^https?:\/\/backup.landof.tv\/.*/)) {
used_site_info.BTN.url = 'https://backup.landof.tv/';
GM_setValue('used_site_info', JSON.stringify(used_site_info));
} else if (site_url.match(/^https?:\/\/broadcasthe.net\/.*/)) {
used_site_info.BTN.url = 'https://broadcasthe.net/';
GM_setValue('used_site_info', JSON.stringify(used_site_info));
}
if (site_url.match(/^https?:\/\/www..agsvpt.com\/.*/)) {
used_site_info.Agsv.url = 'https://www.agsvpt.com/';
GM_setValue('used_site_info', JSON.stringify(used_site_info));
} else if (site_url.match(/^https?:\/\/abroad.agsvpt.com\/.*/)) {
used_site_info.Agsv.url = 'https://abroad.agsvpt.com/';
GM_setValue('used_site_info', JSON.stringify(used_site_info));
}
//支持快速搜索的默认站点列表,可自行添加,举例:imdbid表示tt123456, imdbno表示123456,search_name表示the big bang thoery
const default_search_list = [
`PTP`,
`BTN`,
`HDB`,
`KG`,
`CG`,
`FileList`,
`BHD`,
`BLU`,
`SC`,
`HDPost`,
`TTG`,
`HDT`,
`HDSpace`,
`HDR`,
`HDF`,
`PHD`,
`AVZ`,
`CNZ`,
`xTHOR`,
`Tik`,
`Douban`,
`UHD`,
`ZMK`,
`MediaiInfo`,
`SSW`,
`ACM`,
`JPTV`
];
var used_search_list = GM_getValue('used_search_list') === undefined ? default_search_list : JSON.parse(GM_getValue('used_search_list')).split(',');
//常用站点列表,这里只是举例说明,可以替换成自己想要的站点名称即可
const default_common_sites = ['HDPost', 'TTG', 'CMCT', 'HUDBT', 'PTer'];
var used_common_sites = GM_getValue('used_common_sites') === undefined ? default_common_sites: JSON.parse(GM_getValue('used_common_sites')).split(',');
//签到站点列表
const default_signin_sites = ['HDPost', 'TTG', 'CMCT', 'HUDBT', 'PTer'];
var used_signin_sites = GM_getValue('used_signin_sites') === undefined ? default_common_sites: JSON.parse(GM_getValue('used_signin_sites')).split(',');
//欧美国家列表,可以酌情添加
const us_ue = ['挪威|丹麦|瑞典|芬兰|英国|爱尔兰|荷兰|比利时|卢森堡|法国|西班牙|葡萄牙|德国|奥地利|瑞士|捷克|美国|加拿大|澳大利亚|意大利|波兰|新西兰|西德|苏联|俄罗斯'];
//是否在PTP/HDB/HDT/UHD种子列表显示搜索跳转功能,1表示显示,0表示隐藏
const default_show_search_urls = {
'PTP': 1,
'HDB': 0,
'HDT': 0,
'UHD': 0,
'LHD': 1
};
var show_search_urls = GM_getValue('show_search_urls') === undefined ? default_show_search_urls : JSON.parse(GM_getValue('show_search_urls'));
if (!show_search_urls.hasOwnProperty('LHD')) {
show_search_urls['LHD'] = default_show_search_urls['LHD'];
}
//设置依托界面站点列表
const setting_host_list = {
'PTer': 'https://pterclub.com/usercp.php?action=personal',
'HDDolby': 'https://www.hddolby.com/usercp.php?action=personal',
'DaJiao': 'https://dajiao.cyou/usercp.php?action=personal',
'PThome': 'https://www.pthome.net/usercp.php?action=personal',
'Panda': 'https://pandapt.net/usercp.php?action=personal',
'红叶': 'https://leaves.red/usercp.php?action=personal',
'CyanBug': 'https://cyanbug.net/usercp.php?action=personal',
'MTeam': 'https://kp.m-team.cc/usercp.php?action=personal',
'UBits': 'https://ubits.club/usercp.php?action=personal'
};
var used_setting_host_list = GM_getValue('setting_host_list') === undefined ? setting_host_list : JSON.parse(GM_getValue('setting_host_list'));
const default_rehost_img_info = {
'freeimage': {
'url': 'https://freeimage.host/page/api',
'api-url': 'https://freeimage.host/api/1/upload',
'api-key': ''
},
'gifyu': {
'url': 'https://gifyu.com/',
'api-url': 'https://gifyu.com/api/1/upload',
'api-key': ''
},
'pstorage': {
'url': 'https://pstorage.space/pages/api',
'api-url': 'https://pstorage.space/api/1/upload',
'api-key': ''
},
'imgbb': {
'url': 'https://api.imgbb.com/',
'api-url': 'https://api.imgbb.com/1/upload',
'api-key': ''
},
'catbox':{
'url': 'https://catbox.moe/user/api.php',
'api-url': 'https://catbox.moe/user/api.php',
'api-key': ''
},
};
var used_rehost_img_info = GM_getValue('used_rehost_img_info') === undefined ? default_rehost_img_info: JSON.parse(GM_getValue('used_rehost_img_info'));
for (key in default_rehost_img_info) {
if (!used_rehost_img_info.hasOwnProperty(key)){
used_rehost_img_info[key] = default_rehost_img_info[key];
}
}
/*******************************************************************************************************************
* part 2 常量、变量及函数定义封装层 *
********************************************************************************************************************/
//用于作为源站点但是不是转发站点的字典,大部分都外站,用作判断是否是外站的标准
const o_site_info = {
'FRDS': 'https://pt.keepfrds.com/',
'BeiTai': 'https://www.beitai.pt/',
'BYR': 'https://byr.pt/',
'avz': 'https://avistaz.to/',
'PHD': 'https://privatehd.to/',
'PTP': 'https://passthepopcorn.me/',
'HDT': used_site_info.HDT.url,
'MTV': 'https://www.morethantv.me/',
'BHD': 'https://beyond-hd.me/',
'UHD': 'https://uhdbits.org/',
'BLU': 'https://blutopia.cc/',
'Aither': 'https://aither.cc/',
'HDPost': 'https://pt.hdpost.top/',
'KIMOJI': 'https://kimoji.club/',
'TorrentLeech': 'https://www.torrentleech.org/',
'xthor': 'https://xthor.tk/',
'FileList': 'https://filelist.io/',
'HDF': 'https://hdf.world/',
'HDB': 'https://hdbits.org/',
'BTN': used_site_info.BTN.url,
'RED': 'https://redacted.ch/',
'OpenCD': 'https://open.cd/',
'U2': 'https://u2.dmhy.org/',
'jpop': 'https://jpopsuki.eu/',
'Bdc': 'https://broadcity.in/',
'CG': 'http://cinemageddon.net/',
'KG': 'https://karagarga.in/',
'SC': 'https://secret-cinema.pw/',
'iTS': 'https://shadowthein.net/',
'HDRoute': 'http://hdroute.org/',
'HDSpace': 'https://hd-space.org/',
'ACM': 'https://asiancinema.me/',
'HDOli': 'https://hd-olimpo.club/',
'Tik': 'https://cinematik.net/',
'CNZ': 'https://cinemaz.to/',
'GPW': 'https://greatposterwall.com/',
'HD-Only': 'https://hd-only.org/',
'NBL': 'https://nebulance.io/',
'ANT': 'https://anthelion.me/',
'IPT': 'https://iptorrents.com/',
'torrentseeds': 'https://torrentseeds.org/',
'IN': 'https://nzbs.in/',
'HOU': 'https://house-of-usenet.com/',
'OMG': 'https://omgwtfnzbs.org/',
'digitalcore': 'https://digitalcore.club/',
'BlueBird': 'https://bluebird-hd.org/',
'bwtorrents': 'https://bwtorrents.tv/',
'lztr': 'https://lztr.me/',
'DICMusic': 'https://dicmusic.com/',
'OPS': 'https://orpheus.network/',
'bib': 'https://bibliotik.me/',
'mam': 'https://www.myanonamouse.net',
'bit-hdtv': 'https://www.bit-hdtv.com/',
'JPTV': 'https://jptv.club/',
'TVV': 'http://tv-vault.me/',
'SugoiMusic': 'https://sugoimusic.me/',
'Monika': 'https://monikadesign.uk/',
'DTR': 'https://desitorrents.tv/',
'HONE': 'https://hawke.uno/',
'ZHUQUE': 'https://zhuque.in/',
'影': 'https://star-space.net/',
'SpeedApp': 'https://speedapp.io/'
};
//部分站点加载图标会有问题,可以将图标下载下来上传到公网图床提供网址即可
const site_img_info = {
'HDHome': 'https://img.pterclub.com/images/2020/04/21/hdhfavicon.png',
'TJUPT': 'https://img.pterclub.com/images/2020/04/21/hdhfavicon.png',
'HDChina': 'https://img.pterclub.com/images/2020/04/21/hdcfavicon.png',
'HDArea': 'https://img.pterclub.com/images/2020/04/21/hdafavicon.png',
'BTSchool': 'https://img.pterclub.com/images/2020/05/05/bts.png',
'HDDolby': 'https://s1.ax1x.com/2020/09/27/0A8NNV.png',
'HDRoute': 'https://s1.ax1x.com/2020/09/27/0A8UhT.png',
'HUDBT': 'https://img.pterclub.com/images/2020/07/15/favicon.png',
'MTeam': 'https://i.endpot.com/image/4BLSA/favicon.jpg',
'HDMaYi': 'http://hdmayi.com/pic/logo.png',
'OurBits': 'https://img.pterclub.com/images/2022/02/19/favicon.png',
'BYR': 'https://img.pterclub.com/images/2021/09/07/byr.jpg',
'avz': 'https://img.pterclub.com/images/2022/04/24/favicon.png',
'PHD': 'https://img.pterclub.com/images/2022/04/24/phd.png',
'CNZ': 'https://img.pterclub.com/images/2022/04/24/cnz.png',
'HDMaYi': 'https://s3.gifyu.com/images/favicon003f5c5008ff0409.png',
'HDT': 'https://s3.gifyu.com/images/favicon-1f27eb036f84ab3b7.png',
'ZHUQUE': 'https://s3.gifyu.com/images/512.png',
'Panda': 'https://i.ibb.co/K9bkd8M/favicon.png',
'PTLSP':'https://img.picgo.net/2023/08/22/lspd78c10dbe9344162.png',
'HaiDan':'https://www.haidan.video/public/pic/favicon.ico',
'象站':'https://img.picgo.net/2023/10/04/ptvicomo0b533c8e4626fe8f.png',
'DaJiao': 'https://www.z4a.net/images/2023/11/20/35c0bb255890b394e4ce76f5718ef1a4.png'
};
//用来拼接发布站点的url和字符串,也可用于识别发布页和源页面
const seperator = '#seperator#';
//获取源站点简称
const origin_site = find_origin_site(site_url);
const douban_prex = 'https://movie.douban.com/subject/';
const imdb_prex = 'https://www.imdb.com/title/';
//iTS的简介模板,用于获取数据替换后填充
const its_base_content = `
[center]
[img]{poster}[/img]
[url={imdb_url}][img]https://i.ibb.co/KD855ZM/IMDb-Logo-2016.png[/img][/url] [size=3]{imdb_score}[/size] [*] [size=3][url={rt_url}][img]https://i.ibb.co/cDSgzxm/rt-logo.png[/img][/url] {rt_score}%[/size] [*] [url={tmdb_url}][img]https://i.ibb.co/VWMtVnN/0fa9aceda3e5.png[/img][/url] [size=3]{tmdb_score}%[/size]
[color=DarkOrange][size=2]◢ SYNOPSIS ◣[/size][/color]
{en_descr}
[color=DarkOrange][size=2]◢ TRAILER ◣[/size][/color]
[youtube]{youtube_url}[/youtube]
[color=DarkOrange][size=2]◢ SCREENSHOTS ◣[/size][/color]
{screenshots}
[/center]
`;
const kg_intro_base_content = `[img]{poster}[/img]
Title: {title}
Genres: {genres}
Date Published: {date}
IMDB Rating: {score}
IMDB Link: {imdb_url}
Directors: {director}
Creators: {creator}
Actors: {cast}
Introduction
{en_descr}
Screenshots here:
{screenshots}
-------------------------------------------------------------------------------------------------------------
Not my rip. Many thanks to the original uploader.
-------------------------------------------------------------------------------------------------------------
`;
const kg_dvd_base_content = `DVD label: {label}
DVD5 / DVD9: {size}
DVD Format: {source}
DVD Audio: Codec {audio}, Channels {channels}
Program(s): Not my rip.
Menus: Untouched
Video: Untouched
Audio: Untouched
DVD extras: Untouched
Extras contain: {extras}
DVD runtime(s): {runtime}
`;
const kg_bluray_base_content = `Blu-Ray label: {label}
BD25 / BD50: {size}
Blu-Ray Audio: Codec {audio}, Channels {channels}
Program(s): Not my rip.
Menus: Untouched
Video: Untouched
Audio: Untouched
DVD extras: Untouched
Extras contain: {extras}
Blu-Ray runtime(s): {runtime}
`;
//需要从源网页获取的信息,有些可能没有
var raw_info = {
//填充类信息
'name': '', //主标题
'small_descr': '', //副标题
'url': '', //imdb链接
'dburl': '', //豆瓣链接
'descr': '', //简介
'log_info': '', //音乐特有
'tracklist': '', //音乐特有
'music_type': '', //音乐特有
'music_media': '', //音乐特有
'edition_info': '',//音乐特有
'music_name': '', //音乐特有
'music_author': '', //音乐特有
'log_info': '', //音乐特有
'animate_info': '', //动漫特有|针对北邮人北洋U2的命名方式
'anidb': '', //动漫特有
'torrentName': '', //动漫辅助
'images': [], // 截图
'torrent_name': '', // 用于转发内站
'torrent_url': '', // 用于转发内站
//选择类信息
'type': '', //type:可取值——电影/纪录/体育/剧集/动画/综艺……
'source_sel': '', //来源(地区):可取值——欧美/大陆/港台/日本/韩国/印度……
'standard_sel': '', //分辨率:可取值——4K/1080p/1080i/720p/SD
'audiocodec_sel': '', //音频:可取值——AAC/AC3/DTS…………
'codec_sel': '', //编码:可取值——H264/H265……
'medium_sel': '', //媒介:可取值——web-dl/remux/encode……
//其他
'origin_site': '', //记录源站点用于跳转后识别
'origin_url': '', //记录源站点用于跳转后识别
'golden_torrent': false, //主要用于皮转柠檬, 转过去之后会变成字符串
'mediainfo_cmct': '', //适用于春天的info
'imgs_cmct': '', //适用于春天的截图
'full_mediainfo': '', //完整的mediainfo有的站点有长短两种,如:铂金家、猫、春天
'subtitles': [], //针对皮转海豹,字幕
'youtube_url': '', //用于发布iTS
'ptp_poster': '', //用于发布iTS
'comparisons': '', //用于海豹
'version_info': '', //用于海豹
'multi_mediainfo': '', //用于海豹
'labels': 0
};
var no_need_douban_button_sites = ['RED', 'OpenCD', 'lztr', 'DICMusic', 'OPS', 'jpop', 'bib', 'mam', 'SugoiMusic', 'HHClub'];
Array.prototype.remove = function(val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
function ptp_send_images(urls, api_key) {
return new Promise(function(resolve, reject) {
var boundary = "--NN-GGn-PTPIMG";
var data = "";
data += boundary + "\n";
data += "Content-Disposition: form-data; name=\"link-upload\"\n\n";
data += urls.join("\n") + "\n";
data += boundary + "\n";
data += "Content-Disposition: form-data; name=\"api_key\"\n\n";
data += api_key + "\n";
data += boundary + "--";
GM_xmlhttpRequest({
"method": "POST",
"url": "https://ptpimg.me/upload.php",
"responseType": "json",
"headers": {
"Content-type": "multipart/form-data; boundary=NN-GGn-PTPIMG"
},
"data": data,
"onload": function(response) {
if (response.status != 200) reject("Response error " + response.status);
resolve(response.response.map(function (item) {
return "[img]https://ptpimg.me/" + item.code + "." + item.ext + '[/img]';
}));
}
});
});
};
function pix_send_images(urls) {
return new Promise(function(resolve, reject) {
GM_xmlhttpRequest({
"method": "POST",
"url": "https://pixhost.to/remote/",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
},
"data": encodeURI(`imgs=${urls.join('\r\n')}&content_type=0&max_th_size=350`),
"onload": function(response) {
if (response.status != 200) {
reject(response.status);
} else {
const data = response.responseText.match(/(upload_results = )({.*})(;)/);
if (data && data.length) {
var imgResultList = JSON.parse(data[2]).images;
resolve(imgResultList.map(function(item){
return `[url=${item.show_url}][img]${item.th_url}[/img][/url]`;
}));
} else {
console.log(response);
reject('上传失败,请重试');
}
}
}
});
});
};
//添加搜索框架,可以自行添加或者注释站点
function add_search_urls(container, imdbid, imdbno, search_name, mode) {
var div_style = 'align="center" style="border: 1px solid blue;"';
var text = '快速搜索:';
var brs = '';
var font_color = 'red';
if (mode == 1) {
div_style = ''; font_color = 'green'; text = ''; brs = '';
} else if (mode == 2) {
div_style = ''; brs = '';
} else if (mode == 3) {
div_style = ''; font_color = 'green'; text = ''; brs = '';
}
if (raw_info.url) {
tmp_search_list = used_search_list.map((e)=> {
if (e.match(/avistaz|privatehd|cinemaz/)) {
var domain = e.match(/avistaz|privatehd|cinemaz/)[0];
if (raw_info.type == "剧集" || raw_info.name.match(/S\d+|E\d+/i)) {
var o = $(e).attr('href');
var d = $(e).attr('href').replace(/torrents\?in=1&.*/, 'tv-shows?search=&imdb={imdbid}');
return e.replace(o, d);
} else {
var o = $(e).attr('href');
var d = $(e).attr('href').replace(/torrents\?in=1&.*/, 'movies?search=&imdb={imdbid}');
return e.replace(o, d);
}
} else {
return e;
}
})
} else {
if (imdbid == '') {
tmp_search_list = used_search_list.map((e)=> {
if (e.match(/imdbid|imdbno/)) {
e = e.replace(/ {
if (item.includes('ZHUQUE')) {
const zhuquejson = JSON.parse('{"page":1,"size":20,"type":"title","sorter":"id","order":"desc","keyword":"PTer","tags":[],"category":[],"medium":[],"videoCoding":[],"audioCoding":[],"resolution":[],"group":[],"more":false}');
try{
zhuquejson.keyword = search_name.trim();
} catch(err) {}
const b64 = btoa(encodeURIComponent(JSON.stringify(zhuquejson)));
return `ZHUQUE`;
}
return item;
});
var site_search_lists = tmp_search_list.join(' | ');
if ($('.search_urls').length == 1) {
$('.search_urls').hide();
brs = '';
} else if ($('.search_urls').length > 2) {
$('.search_urls').show();
}
if (site_url.match(/^https?:\/\/movie.douban.com/)) {
if (site_search_lists.match(/https:\/\/www.imdb.com.*?imdbid/)) {
site_search_lists = site_search_lists.replace(/www.imdb.com.*?imdbid}/, 'click_new');
}
}
site_search_lists = site_search_lists.format({'imdbid': imdbid, 'imdbno': imdbno, 'search_name': search_name});
container.append(`${brs}${text}${site_search_lists}
`);
container.find('.disabled').attr("disabled",true).click(e=>{
e.preventDefault();
alert('当前影视没有IMDB信息!!');
return;
});
$('.hdb-task').click((e)=>{
GM_setValue('task_info', JSON.stringify(raw_info));
});
if (mode == 1) {
$('.search_urls').find('a').css("color", "darkblue");
}
try {
var imdbid = $('#info').html().match(/tt\d+/i)[0];
var imdb_url = 'https://www.imdb.com/title/' + imdbid;
$('a[href*="click_new"').click(e=>{
e.preventDefault();
window.open(imdb_url, target="_blank");
});
} catch (err) {}
}
//函数用来豆瓣信息搜索时候进行处理, 后期准备作废
const numToChn = function(num) {
var chnNumChar = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
var index = num.toString().indexOf(".");
if (index != -1) {
var str = num.toString().slice(index);
var a = "点";
for (var i = 1; i < str.length; i++) {
a += chnNumChar[parseInt(str[i])];
}
return a;
} else {
return;
}
};
function numToChinese(num) { //定义在每个小节的内部进行转化的方法,其他部分则与小节内部转化方法相同
var chnNumChar = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
var chnUnitChar = ["", "十", "百", "千"];
var str = '',
chnstr = '',
zero = false,
count = 0; //zero为是否进行补零, 第一次进行取余由于为个位数,默认不补零
if (num > 0 && num < 100) {
var v = num % 10;
var q = Math.floor(num / 10);
if (num < 10) { //如果数字为零,则对字符串进行补零
chnstr = chnNumChar[v] + chnstr;
} else if (num == 10) chnstr = chnUnitChar[1];
else if (num > 10 && num < 20) chnstr = "十" + chnNumChar[v];
else {
if (v == 0) chnstr = chnNumChar[q] + "十";
else chnstr = chnNumChar[q] + "十" + chnNumChar[v];
}
}
return chnstr;
}
//用来判断地址属于哪个站点(国内发布站点,国外源站点,或其他)
function find_origin_site(url){
var domain; //域名
var reg; //正则匹配表达式
var key;
//先从发布站点找
for (key in used_site_info){
//获取域名
domain = used_site_info[key].url.split('//')[1].replace('/', '');
reg = new RegExp(domain, 'i');
if (url.match(reg)){
if (key == 'HDB' && url.match(/uhdbits\.org/)){
return 'UHD';
}
return key;
}
}
//再从特殊源站点找
for (key in o_site_info){
//获取域名
domain = o_site_info[key].split('//')[1].replace('/', '');
reg = new RegExp(domain, 'i');
if (url.match(reg)){
return key;
}
}
return 'other';
}
function add_thanks(descr) {
//这部分是属于官种名称匹配,用于声明感谢,可自定义匹配正则以及感谢bbcode
const reg_team_name = {
'MTeam': /-(.*mteam|mpad|tnp|BMDru)/i,
'CMCT': /-(CMCT|cmctv)/i,
'HDSky': /-(hds|.*@HDSky)/i,
'CHDBits': /-(CHD|.*@CHDBits)/i,
'OurBits': /(-Ao|-.*OurBits|-FLTTH|-IloveTV|OurTV|-IloveHD|OurPad|-MGs)$/i,
'TTG': /-(WiKi|DoA|.*TTG|NGB|ARiN)/i,
'HDChina': /-(HDC)/i,
'PTer': /-(Pter|.*Pter)/i,
'HDHome': /(-hdh|.*@HDHome)/i,
'PThome': /(-pthome|-pth|.*@pth)/i,
'Audiences': /(-Audies|.*@Audies|-ADE|-ADWeb|.*@ADWeb)/i,
'PuTao': /-putao/i,
'NanYang': /-nytv/i,
'TLFbits': /-tlf/i,
'HDDolby': /-DBTV|-QHstudIo|Dream$|.*@dream/i,
'FRDS': /-FRDS|@FRDS/i,
'BeiTai': /-BeiTai/i,
'PigGo': /PigoHD|PigoWeb|PiGoNF/i,
'CarPt': /CarPT/i,
'HDVideo': /(-HDVWEB|-HDVMV)/i,
'HDfans': /HDFans/i,
'WT-Sakura': /SakuraWEB|SakuraSUB|WScode/i,
'HHClub': /HHWEB/i,
'HaresClub': /Hares?WEB|HaresTV|DIY@Hares|-hares/i,
'HDPt': /hdptweb/i,
'UBits': /-UBits/i,
'Panda': /AilMWeb|-PANDA|@Panda/i,
'UBits': /@UBits|-UBits/,
'SharkPT': /-Shark/,
'PTCafe': /CafeWEB|CafeTV|DIY@PTCafe/i,
'影': /Ying(WEB|DIY|TV|MV|MUSIC)?$/i,
'DaJiao': /DJWEB|DJTV/i,
'PTLSP': /PTLSP|LSP(WEB|DIY|MUSIC)?$/i,
'象站': /Eleph(WEB|REMUX|Rip|TV|DIY|MUSIC)?$/i,
'OKPT': /OK(WEB|Web)?$/i,
'XHB': /OK(WEB|Web)?$/i,
'Agsv': /AGSV(PT|E|WEB|REMUX|Rip|TV|DIY|MUS)?$/i,
'TJUPT': /TJUPT$/,
'FileList': /Play(HD|SD|WEB|TV)?$/i,
};
const thanks_str = "[quote][b][color=Blue]{site}官组作品,感谢原制作者发布。[/color][/b][/quote]\n\n{descr}";
for (var key in reg_team_name) {
if (raw_info.name.match(reg_team_name[key]) && !raw_info.name.match(/PandaMoon|HDSpace|HDClub|LCHD/i)) {
descr = thanks_str.format({'site': key, 'descr': descr});
}
}
return descr;
}
//标签及其字标签转换为字符串,主要用于获取简介等等, 根据网页树的结构,采用前序遍历递归呈现。
function walkDOM(n) {
do {
if (n.nodeName == 'FONT') {
if (n.color != '') {
n.innerHTML = '[color=' + n.color + ']' + n.innerHTML + '[/color]';
}
if (n.size != '') {
n.innerHTML = '[size=' + n.size + ']' + n.innerHTML + '[/size]';
}
if (n.face != '') {
n.innerHTML = '[font=' + n.face + ']' + n.innerHTML + '[/font]';
}
} else if (n.nodeName == 'SCRIPT'){
n.innerHTML = '';
} else if (n.nodeName == 'SPAN') {
if (n.style.color != '') {
n.innerHTML = '[color=' + rgb_2_hex(n.style.color) + ']' + n.innerHTML + '[/color]';
}
} else if (n.nodeName == 'U'){
n.innerHTML = '[u]' + n.innerHTML + '[/u]';
} else if (n.nodeName == 'A') {
if (n.innerHTML != "" && n.href) {
if (site_url.match(/http(s*):\/\/ptchdbits.co\/details.php.*/i)) {
if (!n.innerHTML.match(/pic\/hdl\.gif/g)) {
n.innerHTML = '[url=' + n.href + ']' + n.innerHTML + '[/url]';
}
} else {
n.innerHTML = '[url=' + n.href + ']' + n.innerHTML + '[/url]';
}
}
} else if (n.nodeName == 'TABLE') {
if (n.innerHTML != "") {
if (site_url.match(/http(s*):\/\/totheglory.im.*|bwtorrents.tv/i)) {
n.innerHTML = '[quote]' + n.innerHTML + '[/quote]';
} else if (site_url.match(/u2.dmhy/)) {
n.innerHTML = '';
}
}
} else if (n.nodeName == 'P') {
if (n.innerHTML != "") {
if (site_url.match(/http(s*):\/\/totheglory.im.*/i)) {
n.innerHTML = '';
} else if (site_url.match(/hdroute/i) && n.className == 'quoted') {
n.innerHTML = '[quote]' + n.innerHTML + '[/quote]';
}
}
if (site_url.match(/hhanclub.top/)) {
n.innerHTML = n.innerHTML + '\n';
}
} else if (n.nodeName == 'FIELDSET' || n.nodeName == 'BLOCKQUOTE') {
if (!site_url.match(/hudbt/i) || n.nodeName != 'BLOCKQUOTE'){
n.innerHTML = '[quote]' + n.innerHTML + '[/quote]';
}
if (n.nodeName == 'FIELDSET' && n.textContent.match(/(温馨提示|郑重声明|您的保种|商业盈利|相关推荐|自动发布|仅供测试宽带|不用保种|本站仅负责连接|感谢发布者|转载请注意礼节)/g)) {
n.innerHTML = '';
}
if (n.nodeName == 'BLOCKQUOTE' && n.textContent.match(/勿作商用/)) {
n.innerHTML = '';
}
} else if (n.nodeName == 'DIV' && n.innerHTML == '代码') {
n.innerHTML = '';
n.nextSibling.innerHTML = '[quote]' + n.nextSibling.innerHTML + '[/quote]';
} else if (n.nodeName == 'DIV' && n.className == 'quoted' && site_url.match(/digitalcore/)) {
n.innerHTML = '[quote]' + n.innerHTML + '[/quote]';
} else if (n.nodeName == 'B') {
n.innerHTML = '[b]' + n.innerHTML + '[/b]';
} else if (n.nodeName == 'DIV' && site_url.match(/npupt/) && n.className == 'well small') {
n.innerHTML = '';
} else if (n.nodeName == '#text' && site_url.match(/npupt/)) {
n.data = n.data.replace(/^ +| +$/g, '');
} else if (n.nodeName == 'BR') {
if (site_url.match(/u2.dmhy.org|ourbits.club|hd-space.org|totheglory.im|blutopia.cc|sharkpt.net|desitorrents.tv|hudbt|cinemageddon|hdpost.top|asiancinema.me|hd-olimpo.club|digitalcore.club|bwtorrents.tv|myanonamouse|greatposterwall.com/i)) {
n.innerHTML = '\r\n';
}
} else if (n.nodeName == 'LEGEND') {
n.innerHTML = '';
} else if (n.nodeName == 'IMG') {
if (site_url.match(/http(s*):\/\/ptchdbits.co\/details.php.*/i)) {
if (!n.src.match(/pic\/hdl\.gif/g)) {
raw_info.descr = raw_info.descr + '[img]' + n.src + '[/img]';
}
} else if (site_url.match(/http(s*):\/\/club.hares.top\/details.php.*/i)) {
if ($(n).attr('lay-src') !== undefined) {
raw_info.descr = raw_info.descr + '[img]' + $(n).attr('lay-src') + '[/img]';
} else {
raw_info.descr = raw_info.descr + '[img]' + n.src + '[/img]';
}
} else if (site_url.match(/http(s*):\/\/.*tjupt.org\/details.php.*/i)) {
if ($(n).attr('data-src') !== undefined) {
raw_info.descr = raw_info.descr + '[img]' + $(n).attr('data-src') + '[/img]';
} else {
raw_info.descr = raw_info.descr + '[img]' + n.src + '[/img]';
}
} else {
raw_info.descr = raw_info.descr + '[img]' + n.src + '[/img]';
}
} else if (n.nodeName=='DIV' && site_url.match(/pthome|audiences/i) && n.className == 'codemain') {
if (raw_info.name.match(/-ADE|-ADWeb/) && raw_info.descr.match(/General/)) {
n.innerHTML = '';
} else if (n.parentNode.className == 'hide' || site_url.match(/pthome/i)) {
if (!n.innerHTML.match(/^\[quote\]/)) {
n.innerHTML = '[quote]' + n.innerHTML + '[/quote]';
}
} else {
n.innerHTML = '';
}
} else if (n.nodeName == 'TD' && n.innerHTML.match(/此处包含部分隐藏内容/)) {
n.innerHTML = '';
} else if (n.nodeName == 'TD' && site_url.match(/tjupt/i) && n.innerHTML.match(/General/)) {
n.innerHTML = '[quote]' + n.innerHTML + '[/quote]';
}
if (n.hasChildNodes()) {
walkDOM(n.firstChild);
} else {
raw_info.descr = raw_info.descr + n.textContent;
}
n = n.nextSibling;
} while (n);
return raw_info.descr;
}
//为了春天获取简介而写的定制节点转文本
function walk_cmct(n) {
do {
if (n.nodeName == 'SPAN') {
if (n.style.color != '') {
n.innerHTML = '[color=' + n.style.color + ']' + n.innerHTML + '[/color]';
}
} else if (n.nodeName == 'A') {
if (n.innerHTML != "") {
n.innerHTML = n.innerHTML;
}
} else if (n.nodeName == 'BR') {
n.innerHTML = '\r\n';
}
if (n.hasChildNodes()) {
walk_cmct(n.firstChild);
} else {
if (n.nodeType !=1){
raw_info.descr = raw_info.descr + n.textContent;
}
}
n = n.nextSibling;
} while (n);
return raw_info.descr;
}
function walk_ptp(n) {
do {
if (n.nodeName == 'A' && n.getAttribute('onclick')){
if (n.getAttribute('onclick').match(/MediaInfoToggleShow|BBCode.spoiler/)) {
n.innerHTML = '';
} else if (n.getAttribute('onclick').match(/BBCode.ScreenshotComparisonToggleShow/)) {
var info = n.getAttribute('onclick').match(/\[.*?\]/g);
var item = info[0].replace(/\[|\]|"/g, '');
var pics_text = '';
info[1].replace(/\[|\]|"|\\/g, '').split(',').forEach((e)=>{
pics_text += `[img]${e.trim()}[/img]`;
});
n.innerHTML = `[comparison=${item}]\n\n${pics_text}\n\n[/comparison]`;
}
} else if (n.nodeName == 'A') {
n.innerHTML = '[url=' + n.href + ']' + n.innerHTML + '[/url]';
} else if (n.nodeName == 'TABLE') {
n.nextSibling.innerHTML = n.nextSibling.textContent;
n.innerHTML = '';
} else if (n.nodeName == 'LI') {
n.innerHTML = ' * ' + n.textContent + '\n';
} else if (n.nodeName == 'STRONG') {
try{
if (n.nextSibling.nextSibling.nextSibling.nodeName == 'BLOCKQUOTE') {
n.nextSibling.nextSibling.nextSibling.innerHTML = `[hide=${n.textContent}]${n.nextSibling.nextSibling.nextSibling.innerHTML}[/hide]`;
n.innerHTML = '';
n.nextSibling.textContent = '';
n.nextSibling.nextSibling.textContent = '';
} else if (n.nextSibling.nextSibling.textContent == 'Show comparison') {
n.textContent = '';
n.nextSibling.textContent = '';
} else {
n.innerHTML = `[b]${n.innerHTML}[/b]`;
}
} catch (err) {
n.innerHTML = `[b]${n.innerHTML}[/b]`;
}
} else if (n.nodeName == 'SPAN') {
if (n.style.cssText.match(/underline/i)) {
n.innerHTML = '[u]' + n.innerHTML + '[/u]';
} else {
n.innerHTML = n.innerHTML;
}
} else if (n.nodeName == 'IMG') {
n.innerHTML = '[img]' + n.src + '[/img]';
} else if (n.nodeName == 'BLOCKQUOTE' && n.textContent.match(/general|Disc Title|DISC INFO|mpls/i)) {
n.innerHTML = `[quote]${n.innerHTML}[/quote]`;
}
if (n.hasChildNodes()) {
walk_ptp(n.firstChild);
} else {
if (n.nodeType !=1){
raw_info.descr = raw_info.descr + n.textContent;
}
}
n = n.nextSibling;
} while (n);
return raw_info.descr;
}
function deal_img_350(pic_info) {
var imgs = pic_info.match(/\[img\].*?(jpg|png).*?\[\/img\]/g);
if (imgs) {
imgs.map((item)=>{
var img_url = item.match(/http.*?(png|jpg)/)[0];
if (img_url.match(/ptpimg/)) {
var new_imgs = `[url=${img_url}]${item.replace('[img]', '[img=350x350]')}[/url]`;
pic_info = pic_info.replace(item, new_imgs);
}
})
}
return pic_info;
}
function deal_img_350_ptpimg(pic_info) {
var imgs = pic_info.match(/\[img\].*?(jpg|png).*?\[\/img\]/g);
if (imgs) {
imgs.map((item)=>{
var img_url = item.match(/http.*?(png|jpg)/)[0];
if (img_url.match(/ptpimg.me/)) {
var new_imgs = `[url=${img_url}]${item.replace('[img]', '[img=350]')}[/url]`;
pic_info = pic_info.replace(item, new_imgs);
}
})
}
return pic_info;
}
//标签节点连带转换成字符串
function domToString (node) {
var tmpNode = document.createElement('div');
tmpNode.appendChild(node);
var str = tmpNode.innerHTML;
tmpNode = node = null; // 解除引用,以便于垃圾回收
return str;
}
//方便进行判断是否是源站点,不然太长了,属于源站点进入逻辑业务层
function judge_if_the_site_as_source() {
if (site_url.match(/^https:\/\/karagarga.in\/upload\.php.*/)) {
return 4;
}
if (site_url.match(/^https:\/\/(broadcasthe.net|backup.landof.tv)\/upload.php.*/)) {
return 5;
}
if (site_url.match(/^https?:\/\/\d+.\d+.\d+.\d+:5678/)) {
return 7;
}
if (site_url.match(/^https?:\/\/.*\/(upload|create|offer).*?(php)?#seperator#/i)) {
return 0;
}
if (site_url.match(/^https:\/\/.*open.cd\/plugin_upload.php#seperator#/i)) {
return 0;
}
if (site_url.match(/^https?:\/\/(avistaz|privatehd|cinemaz).to\/upload\/torrent\/\d+/i)) {
return 6;
}
if (site_url.match(/^https?:\/\/www.hd.ai\/Torrents.upload/i)) {
return 0;
}
if (site_url.match(/^https:\/\/hd-space\.org\/index.php\?page=upload/)){
return 0;
}
if (site_url.match(/^https:\/\/hdcity.city\/upload/)){
return 2;
}
if (site_url.match(/^https:\/\/(pt.hdpost.top|kimoji.club|asiancinema.me|hd-olimpo.club|jptv.club|blutopia.cc|aither.cc|desitorrents.tv|monikadesign.uk|hawke.uno|cinematik.net)\/torrents\/\d+$/)){
return 1;
}
if (site_url.match(/^https:\/\/(www.)?torrentseeds.org\/torrents\/\d+/)){
return 1;
}
if (site_url.match(/^https:\/\/zhuque.in\/torrent\/(info|list)\/\d+/)){
return 1;
}
if (site_url.match(/^https:\/\/bibliotik.me\/torrents\/\d+/)) {
return 1;
}
if (site_url.match(/^https:\/\/www.myanonamouse.net\/t\/\d+/)) {
return 1;
}
if (site_url.match(/^https:\/\/speedapp.io\/browse\/\d+\/t/)) {
return 1;
}
if (site_url.match(/^https:\/\/hd-space.org\/index.php\?page=torrent-details/)) {
return 1;
}
if (site_url.match(/^https:\/\/digitalcore.club\/torrent\/\d+/)){
return 1;
}
if (site_url.match(/^https:\/\/nzbs.in\/.*|^https:\/\/house-of-usenet.*|https:\/\/omgwtfnzbs.org.*/)){
return 1;
}
if (site_url.match(/^https:\/\/nebulance.io\/torrents.php\?id=\d+/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/.*\/.*details.*php.*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/totheglory.im\/t\/.*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/(passthepopcorn.me|tv-vault.me|broadcasthe.net|backup.landof.tv|greatposterwall.com|sugoimusic.me).*torrentid.*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/iptorrents.com\/torrent.php\?id=*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/anthelion.me.*torrentid.*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/secret-cinema.pw.*torrentid.*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/www.morethantv.me.*torrentid.*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/hd-only.org.*torrentid.*/i)) {
return 1;
}
if (site_url.match(/^https:\/\/hdbits\.org\/details\.php\?id=.*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/(privatehd|cinemaz|avistaz).to\/torrent/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/www.morethan.tv\/torrents.php\?id/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/beyond-hd.me\/torrents/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/uhdbits.org\/torrents.php\?id=\d+&torrentid=\d+/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/hdf.world\/torrents.php\?id=\d+&torrentid=\d+/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/jpopsuki.eu\/torrents.php\?id=\d+&torrentid=\d+/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/(redacted.ch|lztr.me|dicmusic.com|orpheus.network)\/torrents.php\?id=\d+&torrentid=\d+/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/www\.torrentleech\.org\/torrent\/*/i)) {
return 1;
}
if (site_url.match(/^http(s*):\/\/xthor.tk\/details.php/i)) {
return 1;
}
}
//判断是否是国内的站点,国内站点架构基本一致且不需要额外获取豆瓣信息
function judge_if_the_site_in_domestic() {
var domain, reg, key;
for (key in o_site_info){
if (key != 'FRDS' && key != 'BeiTai' && key != 'BYR' && key != 'U2' && key != '影'){
domain = o_site_info[key].split('//')[1].replace('/', '');
reg = new RegExp(domain, 'i');
if (site_url.split('#seperator#')[0].match(reg)){
return 0;
}
}
}
return 1;
}
//处理标题业务封装进函数
function deal_with_title(title){
title = title.replace(/\./g, ' ').replace(/torrent$/g, '').trim() + ' ';
if (title.match(/[^\d](2 0|5 1|7 1|1 0|6 1|2 1)[^\d]/)) {
title = title.replace(/[^\d](2 0|5 1|7 1|1 0|6 1|2 1)[^\d]/, function(data){
return data.slice(0,2) + '.'+ data.slice(3,data.length);
}).trim();
}
title = title.replace(/H ?(26[45])/i, "H.$1").replace(/x265[.-]10bit/i, 'x265 10bit');
title = title.replace(/\s+\[2?x?(免费|free)\].*$|\(限时.*\)|\(限時.*\)|\(已审\)/ig, '').replace(/\[.*?\]/ig, '').replace(/剩余时间.*/i, '');
title = title.replace(/\(|\)/ig, '').replace(/ - /, '-').trim();
title = title.replace('_10_', '(_10_)');
title = title.replace('V2.1080p', 'V2 1080p').replace(/mkv$|mp4$/i, '');
return title;
}
//处理副标题逻辑业务封装进函数
function deal_with_subtitle(subtitle){
subtitle = subtitle.replace(/\[checked by.*?\]/i, '').replace(/autoup/i, '').replace(/ +/, ' ').trim();
return subtitle;
}
//字典转成字符串传达到跳转页面
function dictToString(my_dict){
my_dict = fill_raw_info(my_dict, null);
var tmp_string = '', link_str = '#linkstr#', key;
for (key in my_dict){
tmp_string += key + link_str + my_dict[key] + link_str;
}
return tmp_string.slice(0, tmp_string.length-9);
}
//字符串转换成字典回来填充发布页面
function stringToDict(my_string){
var link_str = '#linkstr#';
var tmp_array = my_string.split(link_str);
var tmp_dict = {};
for (i = 0; i < tmp_array.length; i++) {
if (i % 2 == 0) {
tmp_dict[tmp_array[i]] = tmp_array[i + 1];
}
}
return tmp_dict;
}
//下面两个函数用来为字符串赋予format方法:例如——'thank you {site}'.format({'site':'ttg'}) => 'thank you ttg'
String.prototype.replaceAll = function (exp, newStr) {
return this.replace(new RegExp(exp, "gm"), newStr);
};
String.prototype.format = function(args) {
var result = this;
if (arguments.length < 1) {
return result;
}
var data = arguments;
if (arguments.length == 1 && typeof (args) == "object") {
data = args;
}
for ( var key in data) {
var value = data[key];
if (undefined != value) {
result = result.replaceAll("\\{" + key + "\\}", value);
}
}
return result;
};
//下面几个函数为字符串赋予获取各种编码信息的方法——适用于页面基本信息和字符串
String.prototype.medium_sel = function() { //媒介
var result = this.toString();
if (result.match(/(Webdl|Web-dl|WEB[\. ])/i)) {
result = 'WEB-DL';
} else if (result.match(/(UHDTV)/i)) {
result = 'UHDTV';
} else if (result.match(/(HDTV)/i)) {
result = 'HDTV';
} else if (result.match(/(Remux)/i) && ! result.match(/Encode/)) {
result = 'Remux';
} else if (result.match(/(Blu-ray|.MPLS|Bluray原盘)/i) && !result.match(/Encode/i)) {
result = 'Blu-ray';
} else if (result.match(/(UHD|UltraHD)/i) && !result.match(/Encode/i)) {
result = 'UHD';
} else if (result.match(/(Encode|BDRIP|webrip|BluRay)/i) || result.match(/(x|H).?(264|265)/i)) {
result = 'Encode';
} else if (result.match(/(DVDRip|DVD)/i)) {
result = 'DVD';
} else if (result.match(/TV/)) {
result = 'TV';
} else if (result.match(/VHS/)) {
result = 'VHS';
} else if (result.match(/格式: CD|媒介: CD/)) {
result = 'CD';
} else {
result = '';
}
return result;
};
String.prototype.codec_sel = function() { //编码
var result = this;
if (result.match(/(H264|H\.264|AVC)/i)) {
result = 'H264';
} else if (result.match(/(HEVC|H265|H\.265)/i)) {
result = 'H265';
} else if (result.match(/(VVC|H266|H\.266)/i)) {
result = 'H266';
} else if (result.match(/(X265)/i)) {
result = 'X265';
} else if (result.match(/(X264)/i)) {
result = 'X264';
} else if (result.match(/(VC-1)/i)) {
result = 'VC-1';
} else if (result.match(/(MPEG-2)/i)) {
result = 'MPEG-2';
} else if (result.match(/(MPEG-4)/i)) {
result = 'MPEG-4';
} else if (result.match(/(XVID)/i)) {
result = 'XVID';
} else if (result.match(/(VP9)/i)) {
result = 'VP9';
} else if (result.match(/DIVX/i)) {
result = 'DIVX';
} else {
result = '';
}
return result;
};
String.prototype.audiocodec_sel = function() { //音频编码
var result = this.toString();
if (result.match(/(DTS-HDMA:X 7\.1|DTS.?X.?7\.1)/i)){
result = 'DTS-HDMA:X 7.1';
} else if (result.match(/(DTS-HD.?MA)/i)) {
result = 'DTS-HDMA';
} else if (result.match(/(DTS-HD.?HR)/i)) {
result = 'DTS-HDHR';
} else if (result.match(/(DTS-HD)/i)) {
result = 'DTS-HD';
} else if (result.match(/(DTS-X)/i)) {
result = 'DTS-X';
} else if (result.match(/(LPCM)/i)) {
result = 'LPCM';
} else if (result.match(/([ \.]DD|AC3|AC-3|Dolby Digital)/i)) {
result = 'AC3';
} else if (result.match(/(Atmos)/i)) {
result = 'Atmos';
} else if (result.match(/(AAC)/i)) {
result = 'AAC';
} else if (result.match(/(TrueHD)/i)) {
result = 'TrueHD';
} else if (result.match(/(DTS)/i)) {
result = 'DTS';
} else if (result.match(/(Flac)/i)) {
result = 'Flac';
} else if (result.match(/(APE)/i)) {
result = 'APE';
} else if (result.match(/(MP3)/i)) {
result = 'MP3';
} else if (result.match(/(WAV)/i)) {
result = 'WAV';
} else if (result.match(/(OPUS)/i)) {
result = 'OPUS';
} else if (result.match(/(OGG)/i)) {
result = 'OGG';
} else {
result = '';
}
if (this.toString().match(/AUDiO CODEC/i) && this.toString().match(/-WiKi/)) {
result = this.match(/AUDiO CODEC.*/)[0];
result = result.audiocodec_sel();
}
return result;
};
String.prototype.standard_sel = function() {
var result = this;
if (result.match(/(4320p|8k)/i)){
result = '8K';
} else if (result.match(/(1080p|2K)/i)){
result = '1080p';
} else if (result.match(/(720p)/i)){
result = '720p';
} else if (result.match(/(1080i)/i)){
result = '1080i';
} else if (result.match(/(576p|480p)/i)){
result = 'SD';
} else if (result.match(/(1440p)/i)){
result = '144Op';
} else if (result.match(/(2160p|4k)/i)){
result = '4K';
} else {
result = '';
}
return result;
};
//获取类型
String.prototype.get_type = function() {
var result = this.toString();
if (result.match(/(Movie|电影|UHD原盘|films)/i)) {
result = '电影';
} else if (result.match(/(Animation|动漫|動畫|动画|Anime|Cartoons)/i)) {
result = '动漫';
} else if (result.match(/(TV.*Show|综艺)/i)) {
result = '综艺';
} else if (result.match(/(Docu|纪录|Documentary)/i)) {
result = '纪录';
} else if (result.match(/(TV.*Series|剧|TV-PACK|TV-Episode|TV)/i)) {
result = '剧集';
} else if (result.match(/(Music Videos|音乐短片|MV\(演唱\)|MV.演唱会|MV\(音乐视频\)|Music Video|Musics MV|Music-Video|音乐视频|演唱会\/MV|MV\/演唱会)/i)) {
result = 'MV';
} else if (result.match(/(Music|音乐)/i)) {
result = '音乐';
} else if (result.match(/(Sport|体育)/i)) {
result = '体育';
} else if (result.match(/(学习|资料|Study)/i)) {
result = '学习';
} else if (result.match(/(Software|软件)/i)) {
result = '软件';
} else if (result.match(/(Game|游戏)/i)) {
result = '游戏';
} else if (result.match(/(eBook|電子書|电子书|有声书|书籍|book)/i)) {
result = '书籍';
} else {
result = '';
}
return result;
};
String.prototype.source_sel = function() {
var info_text = this;
//来源就在这里获取
if (info_text.match(/(大陆|China|中国|CN|chinese)/i)) {
source_sel = '大陆';
} else if (info_text.match(/(HK&TW|港台|thai)/i)) {
source_sel = '港台';
} else if (info_text.match(/(EU&US|欧美|US\/EU|英美)/i)) {
source_sel = '欧美';
} else if (info_text.match(/(JP&KR|日韩|japanese|korean)/i)) {
source_sel = '日韩';
} else if (info_text.match(/(香港)/i)) {
source_sel = '香港';
} else if (info_text.match(/(台湾)/i)) {
source_sel = '台湾';
} else if (info_text.match(/(日本|JP)/i)) {
source_sel = '日本';
} else if (info_text.match(/(韩国|KR)/i)) {
source_sel = '韩国';
} else if (info_text.match(/(印度)/i)) {
source_sel = '印度';
} else {
source_sel = '';
}
return source_sel;
};
//获取副标题或是否中字、国语、粤语以及DIY
String.prototype.get_label = function(){
var my_string = this.toString();
var name = my_string.split('#seperator#')[0];
var labels = {'gy': false, 'yy': false, 'zz': false, 'diy': false, 'hdr10': false, 'db': false, 'hdr10plus': false, 'yz': false};
if (my_string.match(/([简繁].{0,12}字幕|[简繁中].{0,3}字|DIY.{1,5}字|内封.{0,3}[繁中字])|(Text.*?[\s\S]*?Chinese|Text.*?[\s\S]*?Mandarin|subtitles.*chs|subtitles.*mandarin|subtitle.*chinese|Presentation Graphics.*?Chinese)/i)){
labels.zz = true;
}
if (my_string.match(/(英.{0,12}字幕|英.{0,3}字|内封.{0,3}英.{0,3}字)|(Text.*?[\s\S]*?English|subtitles.*eng|subtitle.*english)/i)){
labels.yz = true;
}
if (my_string.match(/([^多]国.{0,3}语|国.{0,3}配|台.{0,3}语|台.{0,3}配)|(Audio.*Chinese|Audio.*mandarin)/i)){
var sub_str = my_string.match(/([^多]国.{0,3}语|国.{0,3}配|台.{0,3}语|台.{0,3}配)|(Audio.*Chinese|Audio.*mandarin)/i)[0];
if (!sub_str.match(/国家|Subtitles/)) {
labels.gy = true;
}
}
if (name.match(/(粤.{0,3}语|粤.{0,3}配|Audio.*cantonese)/i)){
labels.yy = true;
}
if (name.match(/DIY|-.*?@(MTeam|CHDBits|HDHome|OurBits|HDChina|Language|TTG|Pter|HDSky|Audies|CMCT|Dream|Audies)/i)){
labels.diy = true;
}
if (my_string.match(/HDR10\+/)) {
labels.hdr10plus = true;
} else if (my_string.match(/HDR10/)) {
labels.hdr10 = true;
}
if (my_string.match(/Dolby Vision|杜比视界/i)){
labels.db = true;
}
return labels;
};
function set_selected_option_by_value(my_id, value){
var box = document.getElementById(my_id);
for (i=0; i < box.options.length; i++){
if ( box.options[i].value == value){
box.options[i].selected = true;
}
}
}
//副标题增加原盘版本信息
function blurayVersion(name){
var small_descr;
const ver = ['AUS','CAN','CEE','CZE','ESP','EUR','FRA','GBR','GER','HKG','ITA','JPN','KOR','NOR','NLD','RUS','TWN','USA'];
const ver_chinese=['澳版','加拿大','CEE','捷克','西班牙版','欧版','法版','英版','德版','港版','意大利版','日版','韩版','北欧版','荷兰版','俄版','台版','美版'];
for (i=0; i 0) {
raw_info.dburl = douban_prex + response[0].id;
resolve(raw_info);
} else {
reject();
}
}
});
} else {
resolve(raw_info);
}
});
}
else {
var p = new Promise(function(resolve, reject){
if (is_douban_search_needed){
url = raw_info.url.match(/tt\d+/)[0];
var search_url = 'https://m.douban.com/search/?query=' + url + '&type=movie';
getDoc(search_url, null, function(doc) {
if ($('ul.search_results_subjects', doc).length) {
var douban_url = 'https://movie.douban.com/subject/' + $('ul.search_results_subjects', doc).find('a').attr('href').match(/subject\/(\d+)/)[1];
if (douban_url.search('35580200') > -1) {
reject();
}
raw_info.dburl = douban_url;
resolve(raw_info);
} else {
reject();
}
});
} else {
resolve(raw_info);
}
});
}
return p;
}
//颜色转换rgb转16进制
function rgb_2_hex(data) {
if (data.match(/rgb\((.*)\)/)){
data = data.match(/rgb\((.*)\)/)[1];
data = data.split(',');
color = '#';
for (iii=0; iii{
if (skip_img.indexOf(item) < 0) {
return item;
}
}).join(' ');
} else {
imgs = '';
}
} catch(err) {
imgs = '';
}
info.mediainfo = mediainfo.trim();
info.pic_info = imgs.trim();
return info;
}
function fill_raw_info(raw_info, forward_site){
raw_info.descr = raw_info.descr.replace(/%3A/g, ':').replace(/%2F/g, "/");
raw_info.descr = raw_info.descr.replace('[quote][/quote]', '').replace('[b][/b]', '').replace(/\n\n+/, '\n\n');
raw_info.descr = raw_info.descr.replace('https://pic.imgdb.cn/item/6170004c2ab3f51d91c77825.png', 'https://img93.pixhost.to/images/86/435614074_c5134549f13c2c087d67c9fa4089c49e-removebg-preview.png');
//标题肯定都有,副标题可能没有,从简介获取
if (raw_info.small_descr == ''){
raw_info.small_descr = get_small_descr_from_descr(raw_info.descr, raw_info.name);
}
if (raw_info.type == '电影'){
if (raw_info.descr.match(/类[\s\S]{0,5}别[\s\S]{0,30}纪录片/i)) {
raw_info.type = '纪录';
}
if (raw_info.descr.match(/类[\s\S]{0,5}别[\s\S]{0,30}动画/i)) {
raw_info.type = '动漫';
}
}
//补充豆瓣和imdb链接
if (raw_info.url == ''){
var url = raw_info.descr.match(/http(s*):\/\/www.imdb.com\/title\/tt(\d+)/i);
if (url){
raw_info.url = url[0] + '/';
}
}
if (raw_info.dburl == ''){
var dburl = raw_info.descr.match(/http(s*):\/\/.*?douban.com\/subject\/(\d+)/i);
if (dburl){
raw_info.dburl = dburl[0] + '/';
}
}
raw_info.url = raw_info.url.split('?').pop();
//没有来源或者指向不明
if (raw_info.source_sel == '' || raw_info.source_sel.match(/(港台|日韩)/)){
var region = get_source_sel_from_descr(raw_info.descr);
if (raw_info.source_sel.match(/(港台|日韩)/)) {
if (raw_info.source_sel == '港台') {
if (region == '台湾') {
raw_info.source_sel = '台湾';
}else {
raw_info.source_sel = '香港';
}
} else if (raw_info.source_sel == '日韩') {
if (region == '日本') {
raw_info.source_sel = '日本';
} else {
raw_info.source_sel = '韩国';
}
}
}
if (region != '' && raw_info.source_sel == ''){
raw_info.source_sel = region;
}
}
//如果没有媒介, 从标题获取
if (raw_info.medium_sel == ''){
raw_info.medium_sel = raw_info.name.medium_sel();
if (!raw_info.medium_sel && raw_info.descr.match(/mpls/i)) {
raw_info.medium_sel = 'Blu-ray';
}
}
if (raw_info.medium_sel == 'Blu-ray' && (raw_info.name.match(/UHD|2160P/i) || raw_info.descr.match(/2160p/)) ){
raw_info.medium_sel = 'UHD';
}
//如果没有编码信息
if (raw_info.codec_sel == ''){
raw_info.codec_sel = raw_info.name.codec_sel();
}
//没有音频编码, 从标题获取,最后从简介获取
if (raw_info.audiocodec_sel == ''){
raw_info.audiocodec_sel = raw_info.name.audiocodec_sel();
if (raw_info.audiocodec_sel == ''){
raw_info.audiocodec_sel = raw_info.descr.audiocodec_sel();
}
}
//没有分辨率
if (raw_info.standard_sel == ''){
raw_info.standard_sel = raw_info.name.standard_sel();
}
if (raw_info.standard_sel == '') {
try {
var height = raw_info.descr.match(/Height.*?:(.*?)pixels/i)[1].trim();
if (height == '480' || height == '576') {
raw_info.standard_sel = 'SD';
} else if (height == '720') {
raw_info.standard_sel = '720p';
} else if (height == '1 080') {
raw_info.standard_sel = '1080p';
if (raw_info.descr.match(/Scan.*?type.*?(Interleaved|Interlaced)/i)) {
raw_info.standard_sel = '1080i';
}
} else if (height == '2 160') {
raw_info.standard_sel = '4K';
}
} catch(err) {
if (raw_info.descr.match(/(1080|2160)p/)) {
raw_info.standard_sel = raw_info.descr.match(/(1080|2160)p/)[0].replace('2160p', '4K');
}
}
}
if (raw_info.standard_sel == '1080p') {
if (raw_info.name.standard_sel() == '1080i') {
raw_info.standard_sel = '1080i';
} else {
try {
var mi = get_mediainfo_picture_from_descr(raw_info.descr).mediainfo;
if (mi.match(/1080i|Scan.*?type.*?(Interleaved|Interlaced)/)) {
raw_info.standard_sel = '1080i';
}
} catch (err) {}
}
}
if (raw_info.name.match(/Remux/i)){
raw_info.medium_sel = 'Remux';
}
if (raw_info.name.match(/webrip/i)) {
raw_info.medium_sel = 'WEB-DL';
}
if (raw_info.edition_info.medium_sel()) {
if (raw_info.edition_info.medium_sel() != 'Blu-ray' || raw_info.descr.match(/mpls/i)) {
raw_info.medium_sel = raw_info.edition_info.medium_sel();
} else if (raw_info.edition_info.medium_sel() == 'Blu-ray' && raw_info.edition_info.match(/mkv/i)) {
raw_info.medium_sel = 'Encode';
}
}
if (raw_info.codec_sel == 'H265' && raw_info.name.match(/x265/i)) {
raw_info.codec_sel = 'X265';
}
if (raw_info.audiocodec_sel == 'TrueHD') {
if (raw_info.descr.match(/Atmos/)) {
raw_info.audiocodec_sel = 'Atmos';
}
}
raw_info.descr = raw_info.descr.replace(/\n\n+/g, '\n\n').replace('https://dbimg.audiences.me/?', '').replace('https://imgproxy.pterclub.com/douban/?t=', '');
raw_info.descr = raw_info.descr.replace('https://imgproxy.tju.pt/?url=', '');
if (raw_info.edition_info.codec_sel()) {
raw_info.codec_sel = raw_info.edition_info.codec_sel();
}
if (!raw_info.codec_sel || forward_site == 'PTer') {
if (raw_info.descr.match(/Writing library.*(x264|x265)/)) {
raw_info.codec_sel = raw_info.descr.match(/Writing library.*(x264|x265)/)[1].toUpperCase();
if (raw_info.name.match(/H.?26[45]/)) {
raw_info.name = raw_info.name.replace(/H.?26[45]/i, raw_info.codec_sel.toLowerCase())
}
} else if (raw_info.descr.match(/Video[\s\S]*?Format.*?HEVC/i)){
raw_info.codec_sel = 'H265';
} else if (raw_info.descr.match(/Video[\s\S]*?Format.*?AVC/i)){
raw_info.codec_sel = 'H264';
} else if (raw_info.descr.match(/XviD/i)){
raw_info.codec_sel = 'XVID';
} else if (raw_info.descr.match(/DivX/i)){
raw_info.codec_sel = 'DIVX';
} else if (raw_info.descr.match(/Video[\s\S]*?Format.*?MPEG Video[\s\S]{1,10}Format Version.*?Version 4/i)) {
raw_info.codec_sel = 'MPEG-4';
} else if (raw_info.descr.match(/Video[\s\S]*?Format.*?MPEG Video[\s\S]{1,10}Format Version.*?Version 2/i)) {
raw_info.codec_sel = 'MPEG-2';
}
}
if (raw_info.name.match(/dvdrip/i)) {
raw_info.medium_sel = 'DVD';
}
if (raw_info.origin_site == 'OurBits') {
raw_info.descr = raw_info.descr.replace(/\[quote\]\n/g, '[quote]')
}
try {
if (raw_info.descr.match(/\[quote\].*?官组作品.*?\[\/quote\]/g).length >= 2) {
raw_info.descr = raw_info.descr.split(/\[quote\].*?官组作品.*?\[\/quote\]/g).pop();
raw_info.descr = add_thanks(raw_info.descr);
}
} catch(err) {}
return raw_info;
}
//PTHome、HDHome、杜比标签勾选
function check_label(nodes, value) {
for (i=0; i -1) {
var download_button = document.createElement('input');
var select_img=document.createElement("input");
select_img.setAttribute("type","checkbox");
select_img.setAttribute("id",'select_img');
container.append(select_img);
select_img.style.marginLeft = '8px';
select_img.style.marginRight = '-1px';
select_img.checked = true;
select_img.addEventListener('click', function(e){
if (e.target.checked) {
location.reload();
} else {
$('span.imgCheckbox0').map((index, e)=>{
$(e).replaceWith(e.innerHTML)
});
}
}, false);
download_button.type = "button";
download_button.id = 'download_pngs';
download_button.value = '转存截图';
download_button.style.marginLeft = '0px';
download_button.style.paddingLeft = '2px';
download_button.onclick = function() {
if (textarea.value.match(/ilikeshots/)) {
raw_info.images = textarea.value.match(/https?:\/\/yes\.ilikeshots\.club\/images\/.*?png/g);
}
if (raw_info.images.length > 0) {
download_button.value = '处理中…';
if (raw_info.images[0].match(/ilikeshots/) && !raw_info.images[0].match(/.png|.jpg/)) {
raw_info.images.map((e) => {
getDoc(e, null, function(doc) {
textarea.value += $('#image-viewer-container', doc).find('img').attr('src').replace(/\.md/, '') + '\n';
})
});
}
pix_send_images(raw_info.images)
.then(function(new_urls) {
new_urls = new_urls.toString().split(',');
var urls_append = '';
if (new_urls.length > 1) {
for (var i=0; i<=new_urls.length-2; i+=2) {
urls_append += `${new_urls[i]} ${new_urls[i+1]}\n`
}
if (new_urls.length % 2 == 1) {
urls_append += new_urls[new_urls.length-1] + '\n';
}
} else {
urls_append = new_urls;
}
$('#textarea').val($('#textarea').val() + '\n' + urls_append);
if (site == 'PTP') {
raw_info.descr = raw_info.descr.replace(/\[img\].*?(ptpimg|pixhost).*?\[\/img\]/g, '');
}
raw_info.descr = raw_info.descr + '\n' + urls_append;
set_jump_href(raw_info, 1);
download_button.value = '处理成功';
download_button.disable = true;
})
.catch(function(message){
alert(message);
download_button.disable = true;
download_button.value = '转存失败';
});
}
};
container.appendChild(download_button);
if (site != 'PTP') {
var hdb_transfer = document.createElement('input');
hdb_transfer.type = "button";
hdb_transfer.id = 'transfer_hdb';
hdb_transfer.value = '转存HDB';
hdb_transfer.style.marginLeft = '5px';
hdb_transfer.style.paddingLeft = '2px';
container.appendChild(hdb_transfer);
hdb_transfer.onclick = function() {
if (raw_info.images.length > 0) {
raw_info.images.push(raw_info.name.replace(/ /g, '.'));
GM_setValue('HDB_images', raw_info.images.join(', '));
window.open('https://img.hdbits.org/', '_blank');
} else {
alert('请选择要转存的图片!!!')
}
}
}
}
if (site == 'HDB') {
var send_pixhost = document.createElement('input');
send_pixhost.type = "button";
send_pixhost.id = 'send_pixhost';
send_pixhost.value = 'PIXHOST';
send_pixhost.style.marginLeft = '12px';
send_pixhost.onclick = function() {
if (raw_info.images.length > 0) {
raw_info.images.push(raw_info.name.replace(/ /g, '.'));
GM_setValue('HDB_images', raw_info.images.join(', '));
window.open('https://pixhost.to/', '_blank');
} else {
alert('请选择要转存的图片!!!')
}
};
container.appendChild(send_pixhost);
var send_ptpimg = document.createElement('input');
send_ptpimg.type = "button";
send_ptpimg.id = 'send_ptpimg';
send_ptpimg.value = 'PTPIMG';
send_ptpimg.style.marginLeft = '12px';
send_ptpimg.onclick = function() {
if (raw_info.images.length > 0) {
GM_setValue('HDB_images', raw_info.images.join(', '));
window.open('https://ptpimg.me/', '_blank');
} else {
alert('请选择要转存的图片!!!')
}
};
container.appendChild(send_ptpimg);
var send_imgbox = document.createElement('input');
send_imgbox.type = "button";
send_imgbox.id = 'send_ptpimg';
send_imgbox.value = 'IMGBOX';
send_imgbox.style.marginLeft = '12px';
send_imgbox.onclick = function() {
if (raw_info.images.length > 0) {
raw_info.images.push(raw_info.name.replace(/ /g, '.'));
GM_setValue('HDB_images', raw_info.images.join(', '));
window.open('https://imgbox.com/', '_blank');
} else {
alert('请选择要转存的图片!!!')
}
};
container.appendChild(send_imgbox);
}
if (site != 'IN') {
var textarea = document.createElement('textarea');
textarea.style.marginTop = '12px';
textarea.style.height = '120px';
textarea.style.width = '580px';
textarea.id = 'textarea';
container.appendChild(textarea);
textarea.style.display = 'none';
checkBox.addEventListener('click', function(e){
if (e.target.checked) {
$('#textarea').slideDown();
} else {
$('#textarea').slideUp();
}
}, false);
} else {
checkBox.disabled = true;
}
// 上下结构
if (mode == 1) {
container.align = 'center';
//匹配站点样式,为了美观
if (site == 'MTV'){
$('#douban_button,#ptgen_button,#search_button,#download_pngs').css({"backgroundColor": "#262626"});
} else if (site != 'BTN'){
$('#douban_button,#ptgen_button,#search_button,#download_pngs').css({"border": "1px solid #2F3546", "color": "#FFFFFF", "backgroundColor": "#2F3546"});
if (site == 'PTP') {
textarea.style.width = '675px';
} else if (site == 'GPW') {
input_box.style.width = '330px';
textarea.style.width = '650px';
} else if (site == 'HD-Only') {
input_box.style.width = '260px';
textarea.style.width = '540px';
}
} else if (site == 'BTN') {
textarea.style.width = '530px';
}
} else {
if (['BHD', 'BLU', 'Tik','HDPost', 'ACM', 'HDOli', 'JPTV', 'Monika', 'DTR', 'HONE', 'KIMOJI', 'Aither'].indexOf(site) > -1){
$('#douban_button,#ptgen_button,#search_button,#download_pngs').css({"border": "1px solid #0D8ED9", "color": "#FFFFFF", "backgroundColor": "#292929"});
if (site == 'HONE') {
$('#douban_button,#ptgen_button,#search_button,#download_pngs').css({"width": "80px"})
}
} else if (site == 'TorrentLeech') {
$('#douban_button,#ptgen_button,#search_button,#download_pngs').css({"border": "1px solid green", "color": "#FFFFFF", "backgroundColor": "#292929"});
}
if (site == 'BHD') {
textarea.style.width = '550px';
} else if (site == 'BLU' || site == 'Tik', 'Aither') {
textarea.style.width = '585px';
}
}
if (['HDB','PHD','avz', 'CNZ', 'FileList', 'HDChina', 'TTG'].indexOf(site) > -1) {
var width = textarea.style.width.match(/\d+/)[0];
if (site == 'PHD' || site == 'avz' || site == 'CNZ') {
textarea.style.width = `${parseInt(width) + 90}px`;
} else if (site == 'FileList'){
textarea.style.width = `${parseInt(width) + 35}px`;
} else {
textarea.style.width = `${parseInt(width) + 55}px`;
}
}
//把白框换个颜色
if (['PTP', 'xthor', 'HDF', 'BHD', 'BLU', 'Tik', 'Aither', 'TorrentLeech', 'HDPost', 'ACM', 'HDOli', 'JPTV', 'Monika', 'DTR', 'HONE', 'KIMOJI'].indexOf(site) > -1) {
textarea.style.backgroundColor = '#4d5656';
textarea.style.color = 'white';
input_box.style.backgroundColor = '#4d5656';
input_box.style.color = 'white';
}
if (site == 'TorrentLeech' && $('#off').css('display') == 'none') {
input_box.style.color = 'black';
textarea.style.color = 'black';
douban_button.style.color = 'black';
ptgen_button.style.color = 'black';
search_button.style.color = 'black';
}
}
function get_size_from_descr(descr){
size_ = 0;
try{
if (descr.match(/disc.{1,10}size.*?([\d, ]+).*?bytes/i)){
var size = descr.match(/disc.{1,10}size.*?([\d,\. ]+).*?bytes/i)[1];
size = size.replace(/,|\.| /g, '');
size_ = parseInt(size)/1024/1024/1024;
} else if (descr.match(/size[^\d]{0,20}(\d+\.\d+).+GiB/i)) {
size_ = parseInt(descr.match(/size[^\d]{0,20}(\d+\.\d+).+GiB/i)[1]);
}
} catch (err) {}
return size_;
}
function match_link(site, data) {
var link = '';
if (site == 'imdb' && data.match(/http(s*):\/\/.*?imdb.com\/title\/tt\d+/i)){
link = imdb_prex + data.match(/tt\d{5,13}/i)[0] + '/';
} else if (site == 'douban' && data.match(/http(s*):\/\/.*?douban.com\/subject\/(\d+)/i)){
link = douban_prex + data.match(/subject\/(\d+)/i)[1] + '/';
} else if (site == 'anidb' && data.match(/https:\/\/anidb\.net\/a\d+/i)){
link = data.match(/https:\/\/anidb\.net\/a\d+/i)[0] + '/';
} else if(site == 'tmdb' && data.match(/http(s*):\/\/www.themoviedb.org\//i)){
link = data.match(/http(s*):\/\/www.themoviedb.org\/(tv|movie)\/\d+/i)[0] + '/';
} else if(site == 'tvdb' && data.match(/http(s*):\/\/www.thetvdb.com\//i)){
link = 'https://www.thetvdb.com/?tab=series&id=' + data.match(/https?:\/\/www.thetvdb.com\/.*?id=(\d+)/i)[1];
}
return link;
}
function set_jump_href(raw_info, mode) {
if (mode == 1) {
for (key in used_site_info) {
if (used_site_info[key].enable) {
if ((key == 'ACM' || key == 'JPTV') && (raw_info.type == '剧集' || raw_info.type == '纪录' || raw_info.type == '综艺')) {
forward_url = used_site_info[key].url + 'upload/2';
if (raw_info.type == '纪录' && !raw_info.descr.match(/集.*?数/)) {
forward_url = used_site_info[key].url + 'upload/1';
}
} else if (key == 'ACM'|| key == 'JPTV' || key == 'Monika') {
forward_url = used_site_info[key].url + 'upload/1';
} else if (key == 'HDCity' || key == 'BHD' || key == 'HDB') {
forward_url = used_site_info[key].url + 'upload';
} else if (key == 'BYR' && (raw_info.type == '电影')) {
forward_url = used_site_info[key].url + 'upload.php?type=408';
} else if (key == 'BYR' && (raw_info.type == '剧集')) {
forward_url = used_site_info[key].url + 'upload.php?type=401';
} else if (key == 'BYR' && (raw_info.type == '综艺')) {
forward_url = used_site_info[key].url + 'upload.php?type=405';
} else if (key == 'BYR' && (raw_info.type == '音乐')) {
forward_url = used_site_info[key].url + 'upload.php?type=402';
} else if (key == 'BYR' && (raw_info.type == '动漫')) {
forward_url = used_site_info[key].url + 'upload.php?type=404';
} else if (key == 'BYR' && (raw_info.type == '纪录')) {
forward_url = used_site_info[key].url + 'upload.php?type=410';
} else if (key == 'BLU' && (raw_info.type == '剧集' || raw_info.type == '纪录' || raw_info.type == '综艺')) {
forward_url = used_site_info[key].url + 'torrents/create?category_id=2';
} else if (key == 'BLU') {
forward_url = used_site_info[key].url + 'torrents/create?category_id=1';
} else if (key == 'Tik' && (raw_info.type == '剧集' || raw_info.type == '纪录' || raw_info.type == '综艺')) {
forward_url = used_site_info[key].url + 'torrents/create?category_id=2';
} else if (key == 'Tik') {
forward_url = used_site_info[key].url + 'torrents/create?category_id=1';
} else if ((key == 'avz' || key == 'CNZ' || key == 'PHD') && (raw_info.type == '电影' || raw_info.type == '纪录')) {
forward_url = used_site_info[key].url + 'upload/movie';
} else if (key == 'avz' || key == 'CNZ' || key == 'PHD') {
forward_url = used_site_info[key].url + 'upload/tv';
} else if (key == 'HDSpace') {
forward_url = used_site_info[key].url + 'index.php?page=upload';
} else if (key == 'ZHUQUE') {
forward_url = used_site_info[key].url + 'torrent/upload';
} else if (key == 'KIMOJI' || key == 'HDPost' || key == 'Aither') {
var type_dict = {'电影': 1, '剧集': 2, '动漫': 2, '综艺': 2, '纪录': 2, '音乐': 3, '体育': 2, 'MV': 3};
if (type_dict.hasOwnProperty(raw_info.type)) {
forward_url = used_site_info[key].url + `torrents/create?category_id=${type_dict[raw_info.type]}`;
} else {
forward_url = used_site_info[key].url + 'torrents/create?category_id=1';
}
} else {
forward_url = used_site_info[key].url + 'upload.php';
if (key == 'MTV' && raw_info.url) {
forward_url += '?' + raw_info.url.match(/tt\d+/)[0];
}
}
jump_str = dictToString(raw_info);
document.getElementById(key).href = forward_url + seperator + encodeURI(jump_str);
}
}
} else {
var search_name = get_search_name(raw_info.name);
if (raw_info.url){
var url = raw_info.url.match(/tt\d+/)[0];
for (key in used_site_info) {
if (used_site_info[key].enable) {
if (key == 'TTG') {
forward_url = used_site_info[key].url + 'browse.php?search_field=imdb{name}&c=M'.format({'name': raw_info.url.match(/tt(\d+)/)[1]});
} else if (key == 'HDRoute') {
forward_url = used_site_info[key].url + 'browse.php?s={name}&dp=0&add=0&action=s&or=1&imdb={url}'.format({'name': search_name, 'url': url});
} else if (key == 'PTP' || key == 'GPW') {
forward_url = used_site_info[key].url + 'torrents.php?searchstr={url}'.format({'url': url});
} else if (key == 'SC') {
forward_url = used_site_info[key].url + 'torrents.php?action=advanced&searchsubmit=1&filter_cat=1&cataloguenumber={url}'.format({'url': url});
} else if (key == 'HDB') {
forward_url = used_site_info[key].url + 'browse.php?search={url}'.format({'url': url});
} else if (key == 'MTV') {
forward_url = used_site_info[key].url + 'torrents/browse?searchtext={url}'.format({'url': search_name});
} else if (key == 'BHD') {
forward_url = used_site_info[key].url + 'torrents?imdb={url}'.format({'url': url});
} else if (key == 'NBL') {
forward_url = used_site_info[key].url + 'torrents.php?order_by=time&order_way=desc&searchtext={url}&search_type=0&taglist=&tags_type=0'.format({'url': search_name});
} else if (key == 'ANT') {
forward_url = used_site_info[key].url + 'torrents.php?order_by=time&order_way=desc&searchstr={url}&search_type=0&taglist=&tags_type=0'.format({'url': search_name});
} else if (key == 'UHD') {
forward_url = used_site_info[key].url + 'torrents.php?searchstr={url}'.format({'url': url});
} else if (key == 'HDSpace') {
forward_url = used_site_info[key].url + 'index.php?page=torrents&search={url}&active=1&options=2'.format({'url': url.substring(2)});
} else if ((key == 'avz' || key == 'CNZ' || key == 'PHD') && (raw_info.type == '电影' || raw_info.type == '纪录')) {
forward_url = used_site_info[key].url + 'movies?search=&imdb={url}&tmdb=&tvdb=&year_start=&year_end='.format({'url': url});
} else if (key == 'avz' || key == 'CNZ' || key == 'PHD') {
forward_url = used_site_info[key].url + 'tv-shows?search=&imdb={url}&tmdb=&tvdb=&year_start=&year_end='.format({'url': url});
} else if (key == 'iTS') {
forward_url = used_site_info[key].url + 'browse.php?incldead=0&search={url}'.format({'url': search_name});
} else if (key == 'TVV') {
forward_url = used_site_info[key].url + 'torrents.php?action=advanced&searchstr=&searchtags=&tags_type=1&groupdesc=&imdbid={url}'.format({'url': url});
} else if (key == 'HDPost' || key == 'ACM' || key == 'BLU' || key == 'JPTV' || key == 'Monika' || key == 'KIMOJI' || key == 'Tik' || key == 'Aither') {
forward_url = used_site_info[key].url + 'torrents?imdbId={imdbid}#page/1'.format({'imdbid': url});
} else {
forward_url = used_site_info[key].url + 'torrents.php?incldead=0&spstate=0&inclbookmarked=0&search={url}&search_area=4&search_mode=0'.format({'url': url});
}
try { document.getElementById(key).href = forward_url; } catch(err) {}
}
}
} else {
for (key in used_site_info) {
if (used_site_info[key].enable) {
if (['OpenCD', 'OPS', 'RED'].indexOf(key) >= 0 ) {
if (raw_info.music_name) {
search_name = raw_info.music_name.replace(/\(.*?\)/, '') + ' ' + raw_info.name.match(/(19|20)\d{2}/)[0];
} else {
search_name = raw_info.name.split('-')[1].replace(/\*.*?\*/g, '').trim().replace(/\d{4}$/, '') + ' ' + raw_info.name.match(/(19|20)\d{2}/)[0];
}
} else {
search_name = get_search_name(raw_info.name);
}
if (key == 'TTG') {
forward_url = used_site_info[key].url + 'browse.php?search_field={name}&c=M'.format({'name': search_name});
} else if (key == 'HDRoute') {
forward_url = used_site_info[key].url + 'browse.php?s={name}&dp=0&add=0&action=s&or=1&imdb='.format({'name': search_name});
} else if (key == 'PTP' || key == 'GPW' || key == 'SC') {
forward_url = used_site_info[key].url + 'torrents.php?searchstr={url}'.format({'url': search_name});
} else if (key == 'NBL') {
forward_url = used_site_info[key].url + 'torrents.php?order_by=time&order_way=desc&searchtext={url}&search_type=0&taglist=&tags_type=0'.format({'url': search_name});
} else if (key == 'ANT') {
forward_url = used_site_info[key].url + 'torrents.php?order_by=time&order_way=desc&searchstr={url}&search_type=0&taglist=&tags_type=0'.format({'url': search_name});
} else if (key == 'avz' || key == 'CNZ' || key == 'PHD') {
forward_url = used_site_info[key].url + 'https://avistaz.to/torrents?in=1&search={url}'.format({'url': search_name});
} else if (key == 'MTV') {
forward_url = used_site_info[key].url + 'torrents/browse?searchtext={url}'.format({'url': search_name});
} else if (key == 'iTS') {
forward_url = used_site_info[key].url + 'browse.php?incldead=0&search={url}'.format({'url': search_name});
} else if (key == 'TVV') {
forward_url = used_site_info[key].url + 'torrents.php?action=advanced&searchstr='.format({'url': search_name});
} else if (key == 'SC') {
forward_url = used_site_info[key].url + 'torrents.php?action=basic&searchsubmit=1&searchstr={url}&order_by=time&order_way=desc&tags_type=0'.format({'url': search_name});
} else if (key == 'HDB') {
forward_url = used_site_info[key].url + 'browse.php?descriptions=0&season_packs=0&from=&to=&imdbgt=0&imdblt=10&imdb=&primary_language=&country=&yeargt=&yearlt=&tagsearchtype=or&search={name}'.format({'name': search_name});
} else if (key == 'OpenCD') {
forward_url = used_site_info[key].url + 'torrents.php?incldead=0&spstate=0&inclbookmarked=0&search={name}&search_area=0&search_mode=0'.format({'name': search_name});
} else if (key == 'OPS') {
forward_url = used_site_info[key].url + 'torrents.php?searchstr={name}&tags_type=0&order=time&sort=desc&group_results=1&cleardefault=Clear+default&action=basic&searchsubmit=1'.format({'name': search_name});
} else if (key == 'RED') {
forward_url = used_site_info[key].url + 'torrents.php?searchstr={name}'.format({'name': search_name});
} else {
forward_url = used_site_info[key].url + 'torrents.php?incldead=0&spstate=0&inclbookmarked=0&search={name}&search_area=0&search_mode=0'.format({'name': search_name});
}
try { document.getElementById(key).href = forward_url; } catch(err) { }
}
}
}
}
}
function postData(url, meta, callback) {
GM_xmlhttpRequest({
'method': "POST",
'url': url,
'headers':{
"Content-Type": 'application/x-www-form-urlencoded; charset=UTF-8',
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
},
'data': meta,
onload: function(response) {
callback(response.responseText);
}
});
}
function getDoc(url, meta, callback) {
GM_xmlhttpRequest({
method: 'GET',
url: url,
onload: function (responseDetail) {
if (responseDetail.status === 200) {
let doc = page_parser(responseDetail.responseText);
callback(doc, responseDetail, meta);
} else {
callback('error', null, null);
}
}
});
}
function page_parser(responseText) {
responseText = responseText.replace(/s+src=/ig, ' data-src=');
responseText = responseText.replace(/