Greasy Fork is available in English.

GogoAnime Direct Download Button

Replaces the download link with a direct download link and replaces the video player with plyr.

Versão de: 19/01/2021. Veja: a última versão.

// ==UserScript==
// @name         GogoAnime Direct Download Button
// @namespace    http://tampermonkey.net/
// @version      3.0
// @description  Replaces the download link with a direct download link and replaces the video player with plyr.
// @author       Arjix
// @match        *://*.gogoanime.vc/*
// @match        *://*.gogoanime.tv/*
// @match        *://*.gogoanime.io/*
// @match        *://*.gogoanime.in/*
// @match        *://*.gogoanime.se/*
// @match        *://*.gogoanime.sh/*
// @match        *://*.gogoanime.video/*
// @match        *://*.gogoanime.movie/*
// @match        *://*.gogoanime.so/*
// @match        *://*.gogoanimes.co/*
// @match        *://*.animego.to/*
// @grant        GM_xmlhttpRequest
// @require      https://cdnjs.cloudflare.com/ajax/libs/plyr/3.6.3/plyr.polyfilled.js
// @resource     IMPORTED_CSS https://cdn.plyr.io/3.6.3/plyr.css
// @grant        GM_getResourceText
// @grant        GM_addStyle
// ==/UserScript==


(function() {
    'use strict';
    window.addEventListener("load", function () {
        const my_css = GM_getResourceText("IMPORTED_CSS");
        GM_addStyle(my_css);
        let css = `
            .anime_video_body_watch {
                --plyr-color-main: #ffc119;
            }
            .plyr__gvideo-wrapper::before {
                position: absolute;
                top: 5px;
                left: 5px;
                z-index: 10;
                fill: red;
                content: url(data:image/svg+xml,%3Csvg%20id%3D%22Lager_2%22%20data-name%3D%22Lager%202%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2250.000000pt%22%20height%3D%2250.000000pt%22%20viewBox%3D%220%200%20850.39%20850.39%22%3E%0A%20%20%20%3Cdefs%3E%0A%20%20%20%20%20%20%3Cstyle%3E.cls-1%7Bfill%3A%23d01110%3B%7D%3C%2Fstyle%3E%0A%20%20%20%3C%2Fdefs%3E%0A%20%20%20%3Ctitle%3Efastani_logo_2%3C%2Ftitle%3E%0A%20%20%20%3Cpolygon%20class%3D%22cls-1%22%20points%3D%22836.33%20396.06%20459%20393.73%20459%20246.39%20685.33%20246.39%20836.33%20396.06%22%2F%3E%0A%20%20%20%3Cpolygon%20class%3D%22cls-1%22%20points%3D%22642.5%20630.89%20459%20814.39%20459%20447.39%20826%20447.39%20642.5%20630.89%22%2F%3E%0A%20%20%20%3Cpolygon%20class%3D%22cls-1%22%20points%3D%2211.11%20421.39%20404.09%2028.39%20404.09%20814.39%2011.11%20421.39%2011.11%20421.39%22%2F%3E%0A%3C%2Fsvg%3E);
            }
        `
        GM_addStyle(css)
        const title = document.title
        if (title.includes("Watch")) {
        const link = document.querySelector("li.dowloads").firstChild.href
        var ret = GM_xmlhttpRequest({
            method: "GET",
            url: link,
            onload: function(res) {
                var videoLinks = Array.from(res.response.matchAll(/<a\n.*?[\"'](http.*?)['\"].*?\n.*?(\(.*?\))/gm))
                var qualities = []
                videoLinks.forEach(link => {
                    let quality;
                    if (link[2].includes("720")) {
                        quality = 720
                    } else if (link[2].includes("480")) {
                        quality = 480
                    } else if (link[2].includes("360")) {
                        quality = 360
                    } else if (link[2].includes("HD") || link[2].includes("1080")) {
                        quality = 1080
                    }
                    let obj = {}
                    obj["src"] = link[1]
                    obj["size"] = quality
                    obj["type"] = "video/mp4"
                    qualities.push(obj)
                })
                qualities.sort((a, b) => (a.size > b.size ? 1 : -1))
                qualities = qualities.reverse();
                console.log(qualities)
                var videoLink = videoLinks[0][1]

                var downloadButton = document.querySelector("li.dowloads").firstChild
                downloadButton.href = videoLink
                downloadButton.target = "_self"
                downloadButton.download = document.querySelector("div.anime_video_body > h1").innerText.replace(" at gogoanime", "") + ".mp4"
                document.querySelector("li.dowloads > a > span").innerText = "Direct Download"
                var video = document.createElement('video')


                video.id = "player"
                video.controls = undefined
                video.playsinline = undefined
                video.style["--plyr-color-main"] = "#ffc119"

                var player = document.querySelector('div.anime_video_body_watch')
                player.style['object-fit'] = "contain";
                player.innerHTML = ""
                player.appendChild(video)
                const playerPlr = new Plyr(player.querySelector("video"));
                var elem = document.querySelector('.list_dowload');
                elem.parentNode.removeChild(elem);

                playerPlr.source = {
                type: 'video',
                title: 'Example title',
                sources: qualities
                };
                const servers = document.querySelector('div.anime_muti_link')
                servers.parentNode.removeChild(servers)

  }
})}
    }, false)
})();