TMDB Watch Now Button

Adds a "Watch Now" button with FAST and PRO links on TMDB movie and TV pages, leading directly to the streaming site's video player.

目前為 2025-08-14 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         TMDB Watch Now Button
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds a "Watch Now" button with FAST and PRO links on TMDB movie and TV pages, leading directly to the streaming site's video player.
// @author       RestrictedWord
// @match        https://www.themoviedb.org/movie/*
// @match        https://www.themoviedb.org/tv/*
// @license      GPLv3
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const DEBUG = false;
    const log = (...args) => { if (DEBUG) console.log("[TMDB Watch Now]", ...args); };

    const injectStyles = () => {
        const css = `
            .tmdb-watch-container {
                position: fixed;
                bottom: 20px;
                right: 20px;
                z-index: 99999;
                display: flex;
                border-radius: 8px;
                overflow: hidden;
                box-shadow: 0 4px 12px rgba(0,0,0,0.3);
                font-family: sans-serif;
            }
            .tmdb-watch-label {
                background: #ff4444;
                color: white;
                font-weight: bold;
                padding: 10px 14px;
                font-size: 14px;
                display: flex;
                align-items: center;
            }
            .tmdb-watch-btn {
                padding: 10px 12px;
                font-size: 12px;
                font-weight: bold;
                color: white;
                text-decoration: none;
                display: flex;
                align-items: center;
                transition: background 0.25s;
            }
            .tmdb-fast { background: #4444ff; }
            .tmdb-fast:hover { background: #2222cc; }
            .tmdb-pro { background: #22aa22; }
            .tmdb-pro:hover { background: #1a881a; }
        `;
        document.head.appendChild(Object.assign(document.createElement("style"), { textContent: css }));
    };

    const createButton = ({ vidfastUrl, vidlinkUrl }) => {
        const container = document.createElement("div");
        container.className = "tmdb-watch-container";

        const label = Object.assign(document.createElement("div"), {
            className: "tmdb-watch-label",
            textContent: "▶ Watch Now!"
        });

        const fastBtn = Object.assign(document.createElement("a"), {
            className: "tmdb-watch-btn tmdb-fast",
            textContent: "FAST",
            href: vidfastUrl,
            target: "_blank",
            rel: "noopener noreferrer"
        });

        const proBtn = Object.assign(document.createElement("a"), {
            className: "tmdb-watch-btn tmdb-pro",
            textContent: "PRO",
            href: vidlinkUrl,
            target: "_blank",
            rel: "noopener noreferrer"
        });

        container.append(label, fastBtn, proBtn);
        document.body.appendChild(container);
        log("Button added:", { vidfastUrl, vidlinkUrl });
    };

    const getWatchUrls = () => {
        const parts = window.location.pathname.split("/").filter(Boolean);
        log("Path parts:", parts);

        let type, id, season = 1, episode = 1;

        if (parts[0] === "movie") {
            type = "movie";
            id = parts[1]?.split("-")[0];
        } else if (parts[0] === "tv") {
            type = "tv";
            id = parts[1]?.split("-")[0];
            if (parts[2] === "season" && parts[4] === "episode") {
                season = parts[3];
                episode = parts[5];
            }
        }

        if (!id) return null;

        const baseFast = "https://vidfast.pro";
        const basePro = "https://vidlink.pro";

        return (type === "movie")
            ? { vidfastUrl: `${baseFast}/movie/${id}`, vidlinkUrl: `${basePro}/movie/${id}` }
            : { vidfastUrl: `${baseFast}/tv/${id}/${season}/${episode}`, vidlinkUrl: `${basePro}/tv/${id}/${season}/${episode}` };
    };

    injectStyles();
    const urls = getWatchUrls();
    if (urls) createButton(urls);

})();