watch from url fix

This commit is contained in:
Nikita Krupin 2022-06-01 21:42:43 -04:00
parent 080f085c52
commit c65d8527e5
1 changed files with 15 additions and 11 deletions

View File

@ -159,22 +159,26 @@ export default {
return; return;
} // No text found, no point in calling API } // No text found, no point in calling API
const isLink = linkParser(text);
if (!isLink) {
//--- Auto Suggest ---// //--- Auto Suggest ---//
this.$youtube.autoComplete(text, (res) => { this.$youtube.autoComplete(text, (res) => {
const data = res.replace(/^.*?\(/, "").replace(/\)$/, ""); //Format Response const data = res.replace(/^.*?\(/, "").replace(/\)$/, ""); //Format Response
this.response = JSON.parse(data)[1]; this.response = JSON.parse(data)[1];
console.log(this.response);
}); });
} else {
//--- User Pastes Link, Direct Them To Video ---// //--- User Pastes Link, Direct Them To Video ---//
const isLink = linkParser(text);
if (isLink) {
this.response = [ this.response = [
[
`Watch Video from ID: ${isLink.searchParams.get("v")}`, `Watch Video from ID: ${isLink.searchParams.get("v")}`,
{ id: isLink.searchParams.get("v") }, { id: isLink.searchParams.get("v") },
],
]; ];
console.log("this.response: ", this.response);
return; return;
}
//--- End User Pastes Link, Direct Them To Video ---// //--- End User Pastes Link, Direct Them To Video ---//
}
}, },
youtubeSearch(item) { youtubeSearch(item) {