您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add stream buttons to IMDB and MDBList pages
当前为
// ==UserScript== // @name Debrid Media Manager // @namespace https://bensarmiento.com // @version 1.0.1 // @description Add stream buttons to IMDB and MDBList pages // @author Ben Adrian Sarmiento <[email protected]> // @license MIT // @match https://www.imdb.com/title/* // @match https://www.imdb.com/list/ls* // @match https://www.imdb.com/search/title/* // @match https://mdblist.com/* // @grant none // ==/UserScript== (function () { 'use strict'; const DMM_HOST = 'http://dmm.sarmiento.cc:3000/search?query='; const SEARCH_BTN_LABEL = 'DMM🔎'; const TV_BTN_LABEL = 'DMM: TV'; function createButton(text, url) { const button = document.createElement('button'); button.textContent = text; button.style.marginLeft = '10px'; button.onclick = (event) => { event.preventDefault(); window.open(url, '_blank'); }; return button; } function addButtonToElement(element, text, url) { const button = createButton(text, url); element.appendChild(button); } // IMDB functions function addButtonsToIMDBSingleTitle() { const scriptTag = document.getElementById("__NEXT_DATA__"); const jsonData = JSON.parse(scriptTag.innerHTML); const title = jsonData.props.pageProps.aboveTheFoldData.titleText.text; const yearPublished = jsonData.props.pageProps.aboveTheFoldData.releaseYear.year; const targetElement = document.querySelector('section.ipc-page-background h1 > span'); if (targetElement) { const searchUrl = `${DMM_HOST}${title}%20${yearPublished}`; addButtonToElement(targetElement, SEARCH_BTN_LABEL, searchUrl); } } function addButtonsToIMDBList() { const items = document.querySelectorAll('div.lister-item-content > h3'); items.forEach((item) => { const [rawTitle, yearRange] = item.innerText.split(" ("); const title = rawTitle.replace(/^\d+\.\s*/, ''); // Split the year range by the dash to get the start and end years (if available) const [startYear, endYear] = yearRange.replace(")", "").split("–"); // Select the year (if available) or the first year from the year range const year = startYear || endYear; const searchUrl = `${DMM_HOST}${title}%20${year}`; addButtonToElement(item, SEARCH_BTN_LABEL, searchUrl); }); } // MDBList functions function addButtonsToMDBListSingleTitle() { const targetElement = document.querySelector('#content-desktop-2 > div > div:nth-child(1) > h3'); if (targetElement) { const searchUrl = `${DMM_HOST}${targetElement.innerText}`; addButtonToElement(targetElement, SEARCH_BTN_LABEL, searchUrl); } } function addButtonsToMDBListSearchResults() { const items = document.querySelectorAll('div.ui.centered.cards > div'); items.forEach((item) => { const targetElement = item.querySelector('div.header'); if (targetElement) { const searchUrl = `${DMM_HOST}${targetElement.innerText}`; addButtonToElement(targetElement, SEARCH_BTN_LABEL, searchUrl); } }); } const hostname = window.location.hostname; if (hostname === 'www.imdb.com') { const isIMDBSingleTitlePage = /^\/title\//.test(location.pathname); const isIMDBListPage = /^\/search\//.test(location.pathname) || /^\/list\/ls/.test(location.pathname); if (isIMDBSingleTitlePage) { addButtonsToIMDBSingleTitle(); } else if (isIMDBListPage) { addButtonsToIMDBList(); } } else if (hostname === 'mdblist.com') { const isMDBListSingleTitlePage = /^\/(movie|show)\//.test(location.pathname); if (isMDBListSingleTitlePage) { addButtonsToMDBListSingleTitle(); } else { addButtonsToMDBListSearchResults(); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址