Update src/components/WatchVideo.vue

This commit is contained in:
sweep-ai[bot] 2023-08-05 12:34:41 +00:00 committed by GitHub
parent c4b8824f68
commit 55d69868b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -463,7 +463,7 @@ export default {
if (!this.isEmbed) this.fetchSubscribedStatus(); if (!this.isEmbed) this.fetchSubscribedStatus();
const parser = new DOMParser(); const parser = new DOMParser();
const xmlDoc = parser.parseFromString(this.video.description, "text/html"); const xmlDoc = parser.parseFromString(this.video.description, "text/html");
xmlDoc.querySelectorAll("a").forEach(elem => { xmlDoc.querySelectorAll("a").forEach(elem => {
if (!elem.innerText.match(/(?:[\d]{1,2}:)?(?:[\d]{1,2}):(?:[\d]{1,2})/)) if (!elem.innerText.match(/(?:[\d]{1,2}:)?(?:[\d]{1,2}):(?:[\d]{1,2})/))
elem.outerHTML = elem.getAttribute("href").replace(/https:\/\/www\.youtube\.com\/watch\?v=/, "/watch?v="); elem.outerHTML = elem.getAttribute("href").replace(/https:\/\/www\.youtube\.com\/watch\?v=/, "/watch?v=");