Added liveAt property in YouTube Video

This commit is contained in:
killer069 2022-02-11 18:35:17 +05:30
parent e939585c17
commit e60e71125e
3 changed files with 8 additions and 2 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "play-dl", "name": "play-dl",
"version": "1.8.6", "version": "1.8.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "play-dl", "name": "play-dl",
"version": "1.8.6", "version": "1.8.7",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"play-audio": "^0.5.2" "play-audio": "^0.5.2"

View File

@ -119,6 +119,10 @@ export class YouTubeVideo {
* YouTube Video Uploaded Date * YouTube Video Uploaded Date
*/ */
uploadedAt?: string; uploadedAt?: string;
/**
* YouTube Live Date
*/
liveAt?: string;
/** /**
* If the video is upcoming or a premiere that isn't currently live, this will contain the premiere date, for watch page playlists this will be true, it defaults to undefined * If the video is upcoming or a premiere that isn't currently live, this will contain the premiere date, for watch page playlists this will be true, it defaults to undefined
*/ */
@ -174,6 +178,7 @@ export class YouTubeVideo {
this.durationRaw = data.duration_raw || '0:00'; this.durationRaw = data.duration_raw || '0:00';
this.durationInSec = (data.duration < 0 ? 0 : data.duration) || 0; this.durationInSec = (data.duration < 0 ? 0 : data.duration) || 0;
this.uploadedAt = data.uploadedAt || undefined; this.uploadedAt = data.uploadedAt || undefined;
this.liveAt = data.liveAt || undefined;
this.upcoming = data.upcoming; this.upcoming = data.upcoming;
this.views = parseInt(data.views) || 0; this.views = parseInt(data.views) || 0;
const thumbnails = []; const thumbnails = [];

View File

@ -244,6 +244,7 @@ export async function video_basic_info(url: string, options: InfoOptions = {}):
duration: Number(vid.lengthSeconds), duration: Number(vid.lengthSeconds),
duration_raw: parseSeconds(vid.lengthSeconds), duration_raw: parseSeconds(vid.lengthSeconds),
uploadedAt: microformat.publishDate, uploadedAt: microformat.publishDate,
liveAt: microformat.liveBroadcastDetails?.startTimestamp,
upcoming: upcomingDate, upcoming: upcomingDate,
thumbnails: vid.thumbnail.thumbnails, thumbnails: vid.thumbnail.thumbnails,
channel: { channel: {