// ==UserScript==
// @name 从tmdb直接跳转moviepilot搜索资源
// @version 0.0.1
// @description 从tmdb跳转moviepilot搜索资源
// @author thsrite
// @match *://www.themoviedb.org/movie/*
// @match *://www.themoviedb.org/tv/*
// @license MIT
// @note 24-03-12 0.0.1 init
// @namespace https://greasyfork.org/users/1153077
// @downloadURL https://update.greasyfork.cloud/scripts/489619/%E4%BB%8Etmdb%E7%9B%B4%E6%8E%A5%E8%B7%B3%E8%BD%ACmoviepilot%E6%90%9C%E7%B4%A2%E8%B5%84%E6%BA%90.user.js
// @updateURL https://update.greasyfork.cloud/scripts/489619/%E4%BB%8Etmdb%E7%9B%B4%E6%8E%A5%E8%B7%B3%E8%BD%ACmoviepilot%E6%90%9C%E7%B4%A2%E8%B5%84%E6%BA%90.meta.js
// ==/UserScript==
// 改成自己的mp地址
const mphost = 'http://192.168.31.103:3003';
(function () {
const title = encodeURIComponent(document.querySelector('title').innerText.replace(/(^\s*)|(\s*$)/g, '').replace(' — The Movie Database (TMDB)', ''));
const locations = location.href.split('/')
let tmdbid = locations[locations.length - 1]
let mtype = locations[locations.length - 2]
const facts = document.querySelector('h2');
const subject = document.querySelector('.tag');
if (!facts || !subject) {
return;
}
if (tmdbid.split('-').length > 1){
tmdbid = tmdbid.split('-')[0]
}
if (mtype == 'movie'){
mtype = '电影'
}else {
mtype = '电视剧'
}
const sectl = document.createElement('span');
facts.insertBefore(sectl, subject.nextSibling);
sectl.insertAdjacentHTML('beforebegin',
createSvg(tmdbid, mtype)
);
function createSvg(tmdbid, mtype) {
return `
`
}
})();