mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
Some huge changes
This commit is contained in:
39
play-dl/YouTube/utils/constants.ts
Normal file
39
play-dl/YouTube/utils/constants.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { YouTubeVideo } from "../classes/Video";
|
||||
|
||||
export interface LiveStreamData {
|
||||
isLive: boolean;
|
||||
dashManifestUrl: string | null
|
||||
hlsManifestUrl: string | null
|
||||
}
|
||||
|
||||
export interface formatData {
|
||||
itag: number;
|
||||
mimeType: string
|
||||
bitrate: number
|
||||
width: number
|
||||
height: number
|
||||
lastModified: string
|
||||
contentLength: string
|
||||
quality: string
|
||||
fps: number
|
||||
qualityLabel: string
|
||||
projectionType: string
|
||||
averageBitrate: number
|
||||
audioQuality: string
|
||||
approxDurationMs: string
|
||||
audioSampleRate: string
|
||||
audioChannels: number
|
||||
url : string
|
||||
signatureCipher : string;
|
||||
cipher : string;
|
||||
loudnessDb : number;
|
||||
targetDurationSec : number;
|
||||
}
|
||||
|
||||
export interface InfoData{
|
||||
LiveStreamData : LiveStreamData
|
||||
html5player : string
|
||||
format : Partial<formatData>[]
|
||||
video_details : YouTubeVideo
|
||||
related_videos: string[]
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { ProxyOptions as Proxy, request } from './../../Request/index';
|
||||
import { format_decipher } from './cipher';
|
||||
import { YouTubeVideo } from '../classes/Video';
|
||||
import { YouTubePlayList } from '../classes/Playlist';
|
||||
import { InfoData } from '../stream';
|
||||
import { InfoData } from './constants';
|
||||
|
||||
interface InfoOptions {
|
||||
proxy?: Proxy[];
|
||||
@@ -79,7 +79,7 @@ export function extractID(url: string): string {
|
||||
* @param options cookie and proxy parameters to add
|
||||
* @returns Data containing video_details, LiveStreamData and formats of video url.
|
||||
*/
|
||||
export async function video_basic_info(url: string, options: InfoOptions = {}) {
|
||||
export async function video_basic_info(url: string, options: InfoOptions = {}) : Promise<InfoData> {
|
||||
let body: string;
|
||||
if (options.htmldata) {
|
||||
body = url;
|
||||
@@ -187,7 +187,7 @@ function parseSeconds(seconds: number): string {
|
||||
* @param options cookie and proxy parameters to add
|
||||
* @returns Data containing video_details, LiveStreamData and formats of video url.
|
||||
*/
|
||||
export async function video_info(url: string, options: InfoOptions = {}) {
|
||||
export async function video_info(url: string, options: InfoOptions = {}): Promise<InfoData> {
|
||||
const data = await video_basic_info(url, options);
|
||||
if (data.LiveStreamData.isLive === true && data.LiveStreamData.hlsManifestUrl !== null) {
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user