YouTube finally Completed

This commit is contained in:
killer069
2021-08-16 17:37:44 +05:30
parent d3893e7636
commit 25627526b2
7 changed files with 516 additions and 268 deletions

View File

@@ -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";

View File

@@ -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}`)
})
}