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