Files
play-dl-test/node-youtube-dl/YouTube/search.ts

13 lines
479 B
TypeScript
Raw Normal View History

2021-08-12 13:28:17 +05:30
import { url_get } from "./utils/request";
import fs from 'fs'
2021-08-12 15:58:55 +05:30
import { ParseSearchInterface, ParseSearchResult } from "./utils/parser";
import { Video } from "./classes/Video";
import { Channel } from "./classes/Channel";
import { PlayList } from "./classes/Playlist";
2021-08-12 13:28:17 +05:30
2021-08-12 15:58:55 +05:30
export async function search(url:string, options? : ParseSearchInterface): Promise<(Video | Channel | PlayList)[]> {
2021-08-12 13:28:17 +05:30
let body = await url_get(url)
2021-08-12 15:58:55 +05:30
let data = ParseSearchResult(body)
return data
2021-08-12 13:28:17 +05:30
}