Use regex to replace URLs.

Close #773
This commit is contained in:
FireMasterK 2022-01-31 04:05:43 +00:00
parent 826bdf4997
commit 07186f8787
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD

View File

@ -282,8 +282,11 @@ export default {
if (!this.isEmbed) this.fetchSubscribedStatus();
this.video.description = this.video.description
.replaceAll("http://www.youtube.com", "")
.replaceAll("https://www.youtube.com", "")
.replaceAll(/(?:http(?:s)?:\/\/)?(?:www\.)?youtube\.com(\/[/a-zA-Z0-9?=&]*)/gm, "$1")
.replaceAll(
/(?:http(?:s)?:\/\/)?(?:www\.)?youtu\.be\/(?:watch\?v=)?([/a-zA-Z0-9?=&]*)/gm,
"/watch?v=$1",
)
.replaceAll("\n", "<br>");
}
});