Greasy Fork

Greasy Fork is available in English.

TMDB Video Player

Add video player from vidsrc.to directly into TheMovieDB movie/serie webpage.

当前为 2024-01-20 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         TMDB Video Player
// @namespace    http://greasyfork.icu/en/scripts/485265-tmdb-video-player
// @version      0.3.1
// @description  Add video player from vidsrc.to directly into TheMovieDB movie/serie webpage.
// @author       Guillome91 & Tommy0412
// @license      MIT
// @match        https://www.themoviedb.org/movie/*
// @match        https://www.themoviedb.org/tv/*
// @icon         https://www.themoviedb.org/favicon.ico
// @connect      themoviedb.org
// @connect      vidsrc.to
// ==/UserScript==

(function() {
    'use strict';
    //Retrieve api number
    const currentUrl = document.URL;
    const api = currentUrl.replace(/[^0-9]/g, "");
    const type = currentUrl.split('/')[3];
    var player_url,location;
    if(type == "movie"){
        player_url= "https://vidsrc.to/embed/movie/"+api;
        console.log(player_url);

        //add player
        location = document.querySelector("div.header");
        let ifr = document.createElement("iframe");
        ifr.id = "vidsrc.to";
        ifr.height = 800;
        ifr.allowFullscreen = "true";
        ifr.webkitallowfullscreen="true";
        ifr.mozallowfullscreen="true";
        ifr.src = player_url;

        location.after(ifr);
    }

    if(type == "tv"){
        location = document.querySelector("div.header");
        player_url = "https://vidsrc.to/embed/tv/"+api;
        let div = document.createElement("div");
        let ifr = document.createElement("iframe");
        ifr.id = "vidsrc.to";
        ifr.height = 400;
        ifr.width = 400;
        ifr.src = player_url;
        ifr.allowFullscreen = "true";
        ifr.webkitallowfullscreen="true";
        ifr.mozallowfullscreen="true";
        div.appendChild(ifr);
        location.after(ifr);
    }
})();