Search command cleaned up

This commit is contained in:
killer069
2021-09-09 12:44:49 +05:30
parent 0b4979f009
commit 68daeed093
2 changed files with 15 additions and 52 deletions

View File

@@ -13,6 +13,7 @@ enum SearchType {
export async function search(search :string, options? : ParseSearchInterface): Promise<(Video | Channel | PlayList)[]> {
let url = 'https://www.youtube.com/results?search_query=' + search.replaceAll(' ', '+')
if(!options || options.type) options = { type : "video" }
if(!url.match('&sp=')){
url += '&sp='
switch(options?.type){