mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-06 04:32:40 +00:00
Add video_info_from_basic_info function
This commit is contained in:
@@ -85,7 +85,7 @@ export async function stream(url: string, options: StreamOptions = {}): Promise<
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Stream command for YouTube using info from video_info function.
|
||||
* Stream command for YouTube using info from video_info or video_info_from_basic_info function.
|
||||
* @param info video_info data
|
||||
* @param options lets you add quality, cookie, proxy support for stream
|
||||
* @returns Stream class with type and stream for playing.
|
||||
|
||||
@@ -2,6 +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';
|
||||
|
||||
interface InfoOptions {
|
||||
proxy?: Proxy[];
|
||||
@@ -176,6 +177,21 @@ export async function video_info(url: string, options: InfoOptions = {}) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Function uses data from video_basic_info and deciphers it if it contains signatures.
|
||||
* @param data basic_video_info data
|
||||
* @returns Data containing video_details, LiveStreamData and formats of video url.
|
||||
*/
|
||||
export async function video_info_from_basic_info(data: InfoData) {
|
||||
if (data.LiveStreamData.isLive === true && data.LiveStreamData.hlsManifestUrl !== null) {
|
||||
return data;
|
||||
} else if (data.format[0].signatureCipher || data.format[0].cipher) {
|
||||
data.format = await format_decipher(data.format, data.html5player);
|
||||
return data;
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Function to get YouTube playlist info from a playlist url.
|
||||
* @param url Playlist URL
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
export { video_basic_info, video_info, playlist_info, yt_validate, extractID } from './extractor';
|
||||
export {
|
||||
video_basic_info,
|
||||
video_info,
|
||||
video_info_from_basic_info,
|
||||
playlist_info,
|
||||
yt_validate,
|
||||
extractID
|
||||
} from './extractor';
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
export { playlist_info, video_basic_info, video_info, yt_validate, extractID, YouTube, YouTubeStream } from './YouTube';
|
||||
export {
|
||||
playlist_info,
|
||||
video_basic_info,
|
||||
video_info,
|
||||
video_info_from_basic_info,
|
||||
yt_validate,
|
||||
extractID,
|
||||
YouTube,
|
||||
YouTubeStream
|
||||
} from './YouTube';
|
||||
export { spotify, sp_validate, refreshToken, is_expired, Spotify } from './Spotify';
|
||||
export { soundcloud, so_validate, SoundCloud, SoundCloudStream } from './SoundCloud';
|
||||
export { setToken } from './token';
|
||||
|
||||
Reference in New Issue
Block a user