From 616021477ff952c5eb437076eb2c8fdefad2119c Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sat, 5 Aug 2023 12:41:35 +0000 Subject: [PATCH] Update src/components/WatchVideo.vue --- src/components/WatchVideo.vue | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index 4db1438d..aa14c5af 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -462,16 +462,16 @@ export default { this.channelId = this.video.uploaderUrl.split("/")[2]; if (!this.isEmbed) this.fetchSubscribedStatus(); - const parser = new DOMParser(); - const xmlDoc = parser.parseFromString(this.video.description, "text/html"); - xmlDoc.querySelectorAll("a").forEach(elem => { - 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="); - }); - xmlDoc.querySelectorAll("br").forEach(elem => (elem.outerHTML = "\n")); - this.video.description = rewriteDescription(xmlDoc.querySelector("body").innerHTML); + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(this.video.description, "text/html"); + xmlDoc.querySelectorAll("a").forEach(elem => { + 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="); + }); + xmlDoc.querySelectorAll("br").forEach(elem => (elem.outerHTML = "\n")); + this.video.description = rewriteDescription(xmlDoc.querySelector("body").innerHTML); this.updateWatched(this.video.relatedStreams); this.fetchDeArrowContent(this.video.relatedStreams);