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,5 +1,5 @@
|
||||
import got from "got"
|
||||
import { video_info } from "."
|
||||
import { Stream, stream as yt_stream } from "../Stream/stream"
|
||||
|
||||
|
||||
interface FilterOptions {
|
||||
@@ -44,7 +44,7 @@ function parseFormats(formats : any[]): { audio: any[], video:any[] } {
|
||||
function filter_songs(formats : any[], options : FilterOptions) {
|
||||
}
|
||||
|
||||
export async function stream(url : string, options? : StreamOptions): Promise<Stream>{
|
||||
export async function stream(url : string, options? : StreamOptions){
|
||||
let info = await video_info(url)
|
||||
let final: any[] = [];
|
||||
|
||||
@@ -83,5 +83,5 @@ export async function stream(url : string, options? : StreamOptions): Promise<St
|
||||
final.push(info.format[info.format.length - 1])
|
||||
}
|
||||
|
||||
return yt_stream(final[0].url)
|
||||
return got.stream(final[0].url)
|
||||
}
|
||||
@@ -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