mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
YouTube finally Completed
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { url_get } from './request'
|
||||
import { format_decipher, js_tokens } from './cipher'
|
||||
import { Video } from '../classes/Video'
|
||||
import { RequestInit } from 'node-fetch'
|
||||
import { PlayList } from '../classes/Playlist'
|
||||
|
||||
const DEFAULT_API_KEY = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import fetch, { RequestInit } from 'node-fetch'
|
||||
import got, { OptionsOfTextResponseBody } from 'got/dist/source'
|
||||
|
||||
export async function url_get (url : string, options? : RequestInit) : Promise<string>{
|
||||
export async function url_get (url : string, options? : OptionsOfTextResponseBody) : Promise<string>{
|
||||
return new Promise(async(resolve, reject) => {
|
||||
let response = await fetch(url, options)
|
||||
let response = await got(url, options)
|
||||
|
||||
if(response.status === 200) {
|
||||
resolve(await response.text())
|
||||
if(response.statusCode === 200) {
|
||||
resolve(response.body)
|
||||
}
|
||||
else reject(`Got ${response.status} from ${url}`)
|
||||
else reject(`Got ${response.statusCode} from ${url}`)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user