mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-06 04:32:40 +00:00
9 lines
341 B
TypeScript
9 lines
341 B
TypeScript
import got, { OptionsOfTextResponseBody } from 'got/dist/source'
|
|
|
|
export async function url_get (url : string, options? : OptionsOfTextResponseBody) : Promise<string>{
|
|
let response = await got(url, options)
|
|
if(response.statusCode === 200) {
|
|
return response.body
|
|
}
|
|
else throw `Got ${response.statusCode} from ${url}`
|
|
} |