Mypikpak Video Download

A Tampermonkey scrpit for downloading videos from mypikpak.

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.

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

Advertisement:

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!)

Advertisement:

// ==UserScript==
// @name         Mypikpak Video Download
// @name:zh      Mypikpak视频下载器
// @namespace    https://github.com/hugeWrongMistake/MypikpakVideoDownloader_direct
// @author       hugeWrongMistake
// @version      2026-04-14
// @description  A Tampermonkey scrpit for downloading videos from mypikpak.
// @description:zh 从Mypikpak下载视频的Tampermonkey脚本
// @match        https://mypikpak.com/s/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=mypikpak.com
// @grant        GM_registerMenuCommand
// @grant        GM_addElement
// @grant        GM_download
// @connect      localhost
// ==/UserScript==

(function() {
    'use strict';
    function getVideoFilename(){
        const arr = [...document.getElementsByClassName("title")];
        const ele = arr.find((e)=>{return e.innerText.indexOf(".") != -1});
        if(!ele)
        {
            alert("Cant find video name");
            return "download.mp4";
        }
        else{return ele.innerText;}
    }
    function findVideos(cb)
    {
        const arr = document.getElementsByTagName("video");
        if(arr.length <= 0)
        {
            const msg = "Can't find any Video Element";
            alert(msg);
            throw msg;
        }
        const filename = getVideoFilename();
        for(var ele of arr)
        {
            console.log("found a video:" + filename);
            console.log("link:" + ele.currentSrc);
            cb(ele.currentSrc, filename);
        }
    }
    const menu_command_id = GM_registerMenuCommand("Detect Videos",function(event){
        findVideos((url, name)=>{
            if(name = prompt("Download? \n", name)){
                GM_download({url, name, saveAs: true, onerror:(err)=>{console.error(err);}});
                console.log("start download: "+name);
            }
        });
        //
    },"d");
})();