Update tampermonkey script

This commit is contained in:
2024-06-18 18:45:18 +02:00
parent be1f62d27d
commit 85a0dcd8f5

View File

@@ -7,7 +7,7 @@
// @noframes // @noframes
// ==/UserScript== // ==/UserScript==
const API = "https://pocketbase-scratch.site.quack-lab.dev/api/collections/youtubedownload/records"; const URL = `https://youtube-download-ws-server.site.quack-lab.dev/download`;
function waitForElement(element, selector) { function waitForElement(element, selector) {
return new Promise((resolve) => { return new Promise((resolve) => {
@@ -30,13 +30,10 @@ function waitForElement(element, selector) {
} }
function parseVideo(videoElement) { function parseVideo(videoElement) {
console.log(videoElement);
hookVideo(videoElement); hookVideo(videoElement);
} }
function hookVideo(videoElement) { function hookVideo(videoElement) {
console.log("Hooking", videoElement);
videoElement.addEventListener( videoElement.addEventListener(
"mousedown", "mousedown",
function (e) { function (e) {
@@ -47,7 +44,7 @@ function hookVideo(videoElement) {
const link = videoElement.querySelector("a#video-title-link").href; const link = videoElement.querySelector("a#video-title-link").href;
console.log(link); console.log(link);
fetch(API, { fetch(URL, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",