commit
cb5796f15a
@ -45,7 +45,7 @@ const { video_basic_info, stream } = require('play-dl');
|
||||
|
||||
**ES6 modules:**
|
||||
```ts
|
||||
import * as play from 'play-dl'; // Everything
|
||||
import play from 'play-dl'; // Everything
|
||||
|
||||
import { video_basic_info, stream } from 'play-dl'; // Individual functions
|
||||
```
|
||||
|
||||
@ -37,10 +37,7 @@ export function request_stream(req_url: string, options: RequestOpts = { method:
|
||||
* @param options Request options for https request
|
||||
* @returns A promise with the final response object
|
||||
*/
|
||||
function internalRequest(
|
||||
req_url: string,
|
||||
options: RequestOpts = { method: 'GET' }
|
||||
): Promise<IncomingMessage> {
|
||||
function internalRequest(req_url: string, options: RequestOpts = { method: 'GET' }): Promise<IncomingMessage> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let res = await https_getter(req_url, options).catch((err: Error) => err);
|
||||
if (res instanceof Error) {
|
||||
|
||||
@ -298,7 +298,11 @@ export async function video_info(url: string, options: InfoOptions = {}): Promis
|
||||
* @returns Deciphered Video Info {@link InfoData}
|
||||
*/
|
||||
export async function decipher_info<T extends InfoData | StreamInfoData>(data: T): Promise<T> {
|
||||
if (data.LiveStreamData.isLive === true && data.LiveStreamData.dashManifestUrl !== null) {
|
||||
if (
|
||||
data.LiveStreamData.isLive === true &&
|
||||
data.LiveStreamData.dashManifestUrl !== null &&
|
||||
data.video_details.durationInSec === 0
|
||||
) {
|
||||
return data;
|
||||
} else if (data.format[0].signatureCipher || data.format[0].cipher) {
|
||||
data.format = await format_decipher(data.format, data.html5player);
|
||||
|
||||
@ -470,3 +470,57 @@ export function attachListeners(player: EventEmitter, resource: YouTubeStream |
|
||||
player.on(AudioPlayerStatus.Playing, resumeListener);
|
||||
player.once(AudioPlayerStatus.Idle, idleListener);
|
||||
}
|
||||
|
||||
import {
|
||||
decipher_info,
|
||||
deezer,
|
||||
dz_advanced_track_search,
|
||||
extractID,
|
||||
getFreeClientID,
|
||||
is_expired,
|
||||
playlist_info,
|
||||
refreshToken,
|
||||
setToken,
|
||||
soundcloud,
|
||||
spotify,
|
||||
video_basic_info,
|
||||
video_info
|
||||
} from '.';
|
||||
|
||||
export default {
|
||||
DeezerAlbum,
|
||||
DeezerPlaylist,
|
||||
DeezerTrack,
|
||||
SoundCloudPlaylist,
|
||||
SoundCloudStream,
|
||||
SoundCloudTrack,
|
||||
SpotifyAlbum,
|
||||
SpotifyPlaylist,
|
||||
SpotifyTrack,
|
||||
YouTubeChannel,
|
||||
YouTubePlayList,
|
||||
YouTubeVideo,
|
||||
attachListeners,
|
||||
authorization,
|
||||
decipher_info,
|
||||
deezer,
|
||||
dz_advanced_track_search,
|
||||
dz_validate,
|
||||
extractID,
|
||||
getFreeClientID,
|
||||
is_expired,
|
||||
playlist_info,
|
||||
refreshToken,
|
||||
search,
|
||||
setToken,
|
||||
so_validate,
|
||||
soundcloud,
|
||||
spotify,
|
||||
sp_validate,
|
||||
stream,
|
||||
stream_from_info,
|
||||
validate,
|
||||
video_basic_info,
|
||||
video_info,
|
||||
yt_validate
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user