Update src/components/WatchVideo.vue

This commit is contained in:
sweep-ai[bot] 2023-08-05 12:34:56 +00:00 committed by GitHub
parent 02f5d35c57
commit 9b2fec0646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -466,7 +466,9 @@ export default {
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=");
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);