Skip to content

Instantly share code, notes, and snippets.

@Kenya-West
Created June 26, 2020 12:40
Show Gist options
  • Save Kenya-West/58c554514ab487c86bceb128ed5bdd65 to your computer and use it in GitHub Desktop.
Save Kenya-West/58c554514ab487c86bceb128ed5bdd65 to your computer and use it in GitHub Desktop.
joker-video-downloader

Description

A js file for Tampermonkey to get video links in Joker.ykt.ru video page. This project is a script for Joker website.

How to contribute

Clone this project on GitHub and start your changes. If you want to use the script from source code, then create new script in Tampermonkey extension and put source code in opened window.

How to use this script?

You need Tampermonkey extension installed on your browser to use this style.

P. S. Author is not affiliated in any kind of mentioned organizations.

// ==UserScript==
// @name Joker YKT video downloader
// @namespace http://joker.ykt.com/
// @version 0.1
// @description This script downloads video from joker.ykt.ru
// @author Kenya-West
// @match http*://joker.ykt.ru/*/*
// @grant none
// ==/UserScript==
window.onload = () => {
getVideoURLs();
}
function getVideoURLs() {
let linkId = document.querySelector(".vjs-poster").style.backgroundImage;
linkId = /(media\.ykt\.ru.*)\/preview\/preview/gi.exec(linkId)[1];
const linkArray = new Array();
document.querySelectorAll(".vjs-res-button .vjs-menu .vjs-menu-item").forEach(
(element => {
linkArray.push(
{ link: "https://" + linkId + "/file/" + element.innerText + ".mp4", caption: element.innerText }
);
})
);
linkArray.forEach(link => {
const downloadLink = document.createElement("a");
downloadLink.href = link.link;
downloadLink.innerText = "Скачать " + link.caption;
downloadLink.style.margin = "5px 2px";
document.querySelector(".newstitle").appendChild(downloadLink);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment