Watch theYNC Underground videos without needing an account
当前为
// ==UserScript==
// @name theYNC.com Underground bypass
// @description Watch theYNC Underground videos without needing an account
// @namespace Violentmonkey Scripts
// @match https://theync.com/*
// @grant none
// @version 1.0
// @license MIT
// @author -
// ==/UserScript==
function getTheYNCVideoURL(url) {
for (const [, group_url] of url.matchAll(
/https:\/\/theync.com\/media\/thumbs\/(.*?\.mp4)/gm
)) {
return `https://media.theync.com/videos/${group_url}`;
}
}
function waitForElm(selector) {
return new Promise((resolve) => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver((mutations) => {
if (document.querySelector(selector)) {
observer.disconnect();
resolve(document.querySelector(selector));
}
});
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
observer.observe(document.body, {
childList: true,
subtree: true,
});
});
}
waitForElm(".content-block").then((contentBlock) =>
contentBlock
.querySelectorAll(".inner-block > a:has(>.item-info>.border-gold)")
.forEach((element) => {
const thumbnailURL = element.querySelector(".image > img").src;
if (thumbnailURL) {
const videoURL = getTheYNCVideoURL(thumbnailURL);
if (videoURL) {
element.href = getTheYNCVideoURL(thumbnailURL);
}
}
})
);