您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Adds Cineby, Freek, Rive, Vid Binge, XPrime, Wovie, and BrocoFlix buttons to the overview page of shows and movies
当前为
// ==UserScript== // @name trakt.tv Streaming Services Integration // @match https://trakt.tv/movies/* // @match https://trakt.tv/shows/* // @grant none // @version 1.8.1 // @license GPLv3 // @icon https://icons.duckduckgo.com/ip2/trakt.tv.ico // @description Adds Cineby, Freek, Rive, Vid Binge, XPrime, Wovie, and BrocoFlix buttons to the overview page of shows and movies // @run-at document-end // @namespace http://greasyfork.icu/users/1257939 // ==/UserScript== (function() { // Extract and sanitize URL details const extractDetailsFromUrl = (url) => { try { const parts = url.split("/"); return { tmdbId: parts[4], season: parts[6] || 1, // Default to first season on show overview page episode: parts[8] || 1, // Default to first episode on season overview page }; } catch (error) { console.error("Failed to extract URL details:", error); return null; } }; // Sanitize the title by removing year suffix if present const sanitizeTitle = (title) => { try { return title.replace(/-\d{4}$/, ''); } catch (error) { console.error("Failed to sanitize title:", error); return title; } }; // Create a new link element with appropriate attributes const createNewLinkElement = (suffix, targetUrl, textContent) => { try { const linkElement = document.createElement('a'); linkElement.target = "_blank"; linkElement.id = `external-link-${textContent.toLowerCase().replace(" ", "-")}`; linkElement.href = `${targetUrl}/${suffix}`; linkElement.dataset.originalTitle = ""; linkElement.title = ""; linkElement.textContent = textContent; return linkElement; } catch (error) { console.error("Failed to create new link element:", error); return null; } }; // Create external links based on the extracted details const createExternalLink = () => { try { const tmdbLink = document.getElementById("external-link-tmdb"); if (!tmdbLink) { console.error("TMDB link doesn’t exist."); return; } const { tmdbId, season, episode } = extractDetailsFromUrl(tmdbLink.href); const title = sanitizeTitle(location.pathname.split("/")[2]); // Extract title from location const showMovie = location.pathname.split("/")[1] === "movies" ? "movie" : "tv"; const buttonsPath = document.querySelector('.external > li'); if (!buttonsPath) { console.error("Path for buttons doesn’t exist."); return; } const linkElements = [ createNewLinkElement( `${showMovie}/${tmdbId}${showMovie === 'tv' ? `/${season}/${episode}` : ''}`, 'https://www.cineby.app', 'Cineby' ), createNewLinkElement( `watch/${showMovie}/${tmdbId}${showMovie === 'tv' ? `?season=${season}&ep=${episode}` : ''}`, 'https://freek.to', 'Freek' ), createNewLinkElement( `watch?type=${showMovie}&id=${tmdbId}${showMovie === 'tv' ? `&season=${season}&episode=${episode}` : ''}`, 'https://rivestream.live', 'Rive' ), createNewLinkElement( `media/tmdb-${showMovie}-${tmdbId}-${title}`, 'https://www.vidbinge.com', 'Vid Binge' ), createNewLinkElement( `watch/${tmdbId}/${showMovie === 'tv' ? `${season}/${episode}` : ''}`, 'https://xprime.tv', 'XPrime' ), createNewLinkElement( `play/${showMovie}/${tmdbId}/${title}${showMovie === 'tv' ? `?season=${season}&episode=${episode}` : ''}`, 'https://wovie.vercel.app', 'Wovie' ), createNewLinkElement( `pages/info?id=${tmdbId}&type=${showMovie}`, 'https://brocoflix.com', 'BrocoFlix' ), ]; linkElements.forEach(function(linkElement) { if (linkElement) { buttonsPath.appendChild(linkElement); } else { console.log("Failed to create link element:", linkElement); } }); } catch (error) { console.error("Failed to create external links:", error); } }; // Initialize the function when the page loads window.addEventListener('load', () => { createExternalLink(); }); })();