dp-vids.com helper

A script that lets you download videos with the click of a button and hide private videos.

Stan na 02-11-2024. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        dp-vids.com helper
// @namespace   Violentmonkey Scripts
// @match       https://dp-vids.com/*
// @match       https://pnt-vids.com/*
// @grant       none
// @version     1.1
// @author      Penomancer
// @description A script that lets you download videos with the click of a button and hide private videos.
// @license MIT
// ==/UserScript==

(function waitForPageContext(callback, interval = 100) {
    const checkPageContext = setInterval(() => {
        if (typeof window.pageContext !== 'undefined') {
            clearInterval(checkPageContext);
            callback(); // Call the callback function when pageContext is defined
        }
    }, interval);

})(function() {
    'use strict';
    console.log("Starting Script")

    const originalFetch = window.fetch;
    let downloadLink = '';
    const downloadLinkStarter = 'https://dp-vids.com/contents/videos/7000/';
    const downloadLinkStarterPnt = 'https://pnt-vids.com/contents/videos/0/'
    const videoTitle = document.title;


    function addDownloadButton(downloadLink, videoTitle) {
        console.log("Download link for button:", downloadLink)
        const tabsMenu = document.querySelector('.tabs-menu');
        if (tabsMenu) {
            const tabsMenuList = tabsMenu.querySelector('ul');
            const newTab = document.createElement('li');
            tabsMenuList.prepend(newTab);

            const linkElement = document.createElement('a');
            linkElement.textContent = 'Download';
            linkElement.href = downloadLink;
            linkElement.target = '_blank';
            linkElement.className = "toggle-button"
            linkElement.download = videoTitle
            newTab.appendChild(linkElement);
        } else {
            console.error("Parent element not found.");
        }
    }

    if (window.location.href.includes("/videos") || window.location.href.includes("/video") ) {
    console.log("Videos Found")
    const videoId = pageContext.videoId;
    console.log("Video ID:", videoId); // This should print '7798'
    if (window.location.href.includes('dp-vids')) {
       downloadLink = downloadLinkStarter + videoId +'/' + videoId + '.mp4'
       console.log('dp-vids.com Download Link:', downloadLink)
    } else {
       downloadLink = downloadLinkStarterPnt + videoId +'/' + videoId + '.mp4'
      console.log('pnt-vids.com Download Link:', downloadLink)
    }
    console.log("Download Link:", downloadLink)


                    addDownloadButton(downloadLink, videoTitle);
                }


        const observer = new MutationObserver(removeTargetDivs);
        observer.observe(document.body, { childList: true, subtree: true, attributes: true });

})();