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 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         TMDB Watch Now Button
// @namespace    http://tampermonkey.net/
// @version      1.1
// @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: "Source 1",
            href: vidfastUrl,
            target: "_blank",
            rel: "noopener noreferrer"
        });

        const proBtn = Object.assign(document.createElement("a"), {
            className: "tmdb-watch-btn tmdb-pro",
            textContent: "Source 2",
            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);

})();