mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
YouTube
This commit is contained in:
10
node-youtube-dl/YouTube/utils/request.ts
Normal file
10
node-youtube-dl/YouTube/utils/request.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
export async function get (url : string) : Promise<string>{
|
||||
return new Promise(async(resolve, reject) => {
|
||||
let response = await fetch(url)
|
||||
|
||||
if(response.status === 200) resolve(await response.text())
|
||||
else reject(`Got ${response.status} from ${url}`)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user