mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
parent
c78adbbe73
commit
8713a7eaa9
3 changed files with 7 additions and 6 deletions
|
@ -127,8 +127,8 @@ export default {
|
||||||
handleRedirect() {
|
handleRedirect() {
|
||||||
const query = this.$route.query.search_query;
|
const query = this.$route.query.search_query;
|
||||||
const url =
|
const url =
|
||||||
/(?:http(?:s)?:\/\/)?(?:www\.)?youtube\.com(\/[/a-zA-Z0-9?=&]*)/gm.exec(query)?.[1] ??
|
/(?:http(?:s)?:\/\/)?(?:www\.)?youtube\.com(\/[/a-zA-Z0-9_?=&]*)/gm.exec(query)?.[1] ??
|
||||||
/(?:http(?:s)?:\/\/)?(?:www\.)?youtu\.be\/(?:watch\?v=)?([/a-zA-Z0-9?=&]*)/gm
|
/(?:http(?:s)?:\/\/)?(?:www\.)?youtu\.be\/(?:watch\?v=)?([/a-zA-Z0-9_?=&]*)/gm
|
||||||
.exec(query)?.[1]
|
.exec(query)?.[1]
|
||||||
.replace(/^/, "/watch?v=");
|
.replace(/^/, "/watch?v=");
|
||||||
if (url) {
|
if (url) {
|
||||||
|
|
|
@ -183,8 +183,9 @@ export default {
|
||||||
|
|
||||||
videoEl.setAttribute("poster", this.video.thumbnailUrl);
|
videoEl.setAttribute("poster", this.video.thumbnailUrl);
|
||||||
|
|
||||||
if (this.$route.query.t) {
|
const time = this.$route.query.t ?? this.$route.query.start;
|
||||||
const time = this.$route.query.t;
|
|
||||||
|
if (time) {
|
||||||
let start = 0;
|
let start = 0;
|
||||||
if (/^[\d]*$/g.test(time)) {
|
if (/^[\d]*$/g.test(time)) {
|
||||||
start = time;
|
start = time;
|
||||||
|
|
|
@ -286,9 +286,9 @@ export default {
|
||||||
xmlDoc.querySelectorAll("a").forEach(elem => (elem.outerHTML = elem.getAttribute("href")));
|
xmlDoc.querySelectorAll("a").forEach(elem => (elem.outerHTML = elem.getAttribute("href")));
|
||||||
xmlDoc.querySelectorAll("br").forEach(elem => (elem.outerHTML = "\n"));
|
xmlDoc.querySelectorAll("br").forEach(elem => (elem.outerHTML = "\n"));
|
||||||
this.video.description = this.urlify(xmlDoc.querySelector("body").innerHTML)
|
this.video.description = this.urlify(xmlDoc.querySelector("body").innerHTML)
|
||||||
.replaceAll(/(?:http(?:s)?:\/\/)?(?:www\.)?youtube\.com(\/[/a-zA-Z0-9?=&]*)/gm, "$1")
|
.replaceAll(/(?:http(?:s)?:\/\/)?(?:www\.)?youtube\.com(\/[/a-zA-Z0-9_?=&]*)/gm, "$1")
|
||||||
.replaceAll(
|
.replaceAll(
|
||||||
/(?:http(?:s)?:\/\/)?(?:www\.)?youtu\.be\/(?:watch\?v=)?([/a-zA-Z0-9?=&]*)/gm,
|
/(?:http(?:s)?:\/\/)?(?:www\.)?youtu\.be\/(?:watch\?v=)?([/a-zA-Z0-9_?=&]*)/gm,
|
||||||
"/watch?v=$1",
|
"/watch?v=$1",
|
||||||
)
|
)
|
||||||
.replaceAll("\n", "<br>");
|
.replaceAll("\n", "<br>");
|
||||||
|
|
Loading…
Reference in a new issue