TMDB Video Player

Add video player from 2embed.ru directly into TheMovieDB movie/serie webpage.

当前为 2021-12-17 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         TMDB Video Player
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add video player from 2embed.ru directly into TheMovieDB movie/serie webpage.
// @author       Guillome91
// @license      MIT
// @match        https://www.themoviedb.org/movie/*
// @match        https://www.themoviedb.org/tv/*
// @icon         https://www.google.com/s2/favicons?domain=themoviedb.org
// ==/UserScript==

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

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

        location.after(ifr);
    }

    if(type == "tv"){
        var location2 = document.querySelector("div.header");
        var player_url2 = "https://www.2embed.ru/library/tv/"+api;
        console.log(player_url);
        var div = document.createElement("div");
        div.setAttribute('style','border-radius: 25px;overflow: hidden; margin: 15px auto; max-width: 762px;');
        var ifr2 = document.createElement("iframe");
        ifr2.setAttribute('style',"border: 0px none; margin-left: -20px; height: 850px; margin-top: -150px; width: 800px;");
        ifr2.setAttribute('scrolling','no');
        ifr2.id = "2embed";
        ifr2.src = player_url2;
        ifr2.allowFullscreen = "true";
        ifr2.webkitallowfullscreen="true";
        ifr2.mozallowfullscreen="true";
        div.appendChild(ifr2);
        location2.after(div);
    }
})();