Trình phát TMDb

Xem phim và chương trình TV miễn phí trên TMDb

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         TMDb Player
// @name:tr      TMDb Oynatıcı
// @name:de      TMDb Player
// @name:fr      Lecteur TMDb
// @name:es      Reproductor de TMDb
// @name:pt      Reprodutor TMDb
// @name:pt-BR   Reprodutor do TMDb
// @name:ru      TMDb Плеер
// @name:ja      TMDb プレーヤー
// @name:zh-CN   TMDb 播放器
// @name:zh-TW   TMDb 播放器
// @name:ar      مشغل TMDb
// @name:hi      TMDb प्लेयर
// @name:it      Lettore TMDb
// @name:pl      Odtwarzacz TMDb
// @name:ko      TMDb 플레이어
// @name:nl      TMDb Speler
// @name:id      Pemutar TMDb
// @name:vi      Trình phát TMDb
// @name:th      เครื่องเล่น TMDb
// @name:uk      TMDb Програвач
// @name:cs      Přehrávač TMDb
// @name:sv      TMDb Spelare
// @name:da      TMDb Afspiller
// @name:fi      TMDb Toistin
// @name:no      TMDb Spiller
// @name:el      TMDb Πρόγραμμα αναπαραγωγής
// @name:ro      Player TMDb
// @name:hu      TMDb Lejátszó
// @name:sk      Prehrávač TMDb
// @name:bg      TMDb Плейър
// @name:hr      TMDb Player
// @name:sr      TMDb Плејер
// @name:lt      TMDb Grotuvas
// @name:lv      TMDb Atskaņotājs
// @name:et      TMDb Mängija
// @name:ms      Pemain TMDb
// @name:fil     TMDb Player
// @description  Watch movies and TV shows for free on TMDb
// @description:tr  TMDb üzerinde filmleri ve dizileri ücretsiz izleyin
// @description:de  Filme und Serien kostenlos auf TMDb ansehen
// @description:fr  Regardez des films et séries gratuitement sur TMDb
// @description:es  Mira películas y series gratis en TMDb
// @description:pt  Assista filmes e séries gratuitamente no TMDb
// @description:pt-BR Assista filmes e séries gratuitamente no TMDb
// @description:ru  Смотрите фильмы и сериалы бесплатно на TMDb
// @description:ja  TMDbで映画やドラマを無料で視聴
// @description:zh-CN 在 TMDb 上免费观看电影和电视剧
// @description:zh-TW 在 TMDb 上免費觀看電影和電視劇
// @description:ar  شاهد الأفلام والمسلسلات مجانًا على TMDb
// @description:hi  TMDb पर फिल्में और टीवी शो मुफ्त में देखें
// @description:it  Guarda film e serie TV gratuitamente su TMDb
// @description:pl  Oglądaj filmy i seriale za darmo na TMDb
// @description:ko  TMDb에서 영화와 TV 프로그램을 무료로 시청
// @description:nl  Bekijk gratis films en series op TMDb
// @description:id  Tonton film dan serial TV gratis di TMDb
// @description:vi  Xem phim và chương trình TV miễn phí trên TMDb
// @description:th  ดูภาพยนตร์และซีรีส์ฟรีบน TMDb
// @description:uk  Дивіться фільми та серіали безкоштовно на TMDb
// @description:cs  Sledujte filmy a seriály zdarma na TMDb
// @description:sv  Titta på filmer och serier gratis på TMDb
// @description:da  Se film og serier gratis på TMDb
// @description:fi  Katso elokuvia ja sarjoja ilmaiseksi TMDb:ssä
// @description:no  Se filmer og serier gratis på TMDb
// @description:el  Δείτε ταινίες και σειρές δωρεάν στο TMDb
// @description:ro  Urmăriți filme și seriale gratuit pe TMDb
// @description:hu  Nézz filmeket és sorozatokat ingyen az TMDb-n
// @description:sk  Sledujte filmy a seriály zadarmo na TMDb
// @description:bg  Гледайте филми и сериали безплатно в TMDb
// @description:hr  Gledajte filmove i serije besplatno na TMDb
// @description:sr  Гледајте филмове и серије бесплатно на TMDb
// @description:lt  Žiūrėkite filmus ir serialus nemokamai TMDb
// @description:lv  Skatieties filmas un seriālus bez maksas TMDb
// @description:et  Vaadake filme ja sarju tasuta TMDb-s
// @description:ms  Tonton filem dan siri TV secara percuma di TMDb
// @description:fil Panoorin ang mga pelikula at palabas nang libre sa TMDb
// @namespace    https://greasyfork.org/users/1372128
// @version      1.0
// @author       Dragon9135
// @match        *://www.themoviedb.org/tv/*
// @match        *://www.themoviedb.org/movie/*
// @icon         https://www.themoviedb.org/favicon.ico
// @grant        none
// @license      MPL-2.0
// ==/UserScript==

(function () {
    'use strict';

    function getContentInfo() {
        const path = window.location.pathname;

        let type = null;
        let id = null;

        let tvMatch = path.match(/^\/tv\/(\d+)/);
        if (tvMatch) {
            type = "tv";
            id = tvMatch[1];
        }

        let movieMatch = path.match(/^\/movie\/(\d+)/);
        if (movieMatch) {
            type = "movie";
            id = movieMatch[1];
        }

        return { type, id };
    }

    function updateButton() {
        const container = document.querySelector("div.text");
        if (!container) return;

        if (container.dataset.vidfastApplied) return;

        const h4 = container.querySelector("h4");
        const link = container.querySelector("a.no_click");

        if (!h4 || !link) return;

        const { type, id } = getContentInfo();
        if (!type || !id) return;

        h4.textContent = "Now Free Streaming";
        link.title = "Now Free Streaming on VidFast";

        let newUrl = "";
        if (type === "tv") {
            newUrl = `https://vidfast.pro/tv/${id}/1/1`;
        } else {
            newUrl = `https://vidfast.pro/movie/${id}`;
        }

        link.href = newUrl;
        link.target = "_blank";

        link.onclick = function (e) {
            e.preventDefault();
            e.stopPropagation();
            window.open(newUrl, "_blank");
        };

        container.dataset.vidfastApplied = "true";
    }

    function init() {
        updateButton();

        const observer = new MutationObserver(() => {
            updateButton();
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    window.addEventListener("load", init);

})();