diff --git a/src/parser/classes/misc/VideoDetails.ts b/src/parser/classes/misc/VideoDetails.ts index 4b6ad88d..f3cde3e6 100644 --- a/src/parser/classes/misc/VideoDetails.ts +++ b/src/parser/classes/misc/VideoDetails.ts @@ -13,7 +13,9 @@ class VideoDetails { view_count: number; author: string; is_private: boolean; + is_live: boolean; is_live_content: boolean; + is_upcoming: boolean; is_crawlable: boolean; constructor(data: any) { @@ -29,7 +31,9 @@ class VideoDetails { this.view_count = parseInt(data.viewCount); this.author = data.author; this.is_private = !!data.isPrivate; + this.is_live = !!data.isLive; this.is_live_content = !!data.isLiveContent; + this.is_upcoming = !!data.isUpcoming; this.is_crawlable = !!data.isCrawlable; } } diff --git a/test/constants.ts b/test/constants.ts index 083ccc03..ef338ec7 100644 --- a/test/constants.ts +++ b/test/constants.ts @@ -14,6 +14,14 @@ export const VIDEOS = [ { ID: 'OqiXFXlYFi8', QUERY: 'formatted comment text' + }, + { + ID: 'O3cCYok_ukk', + QUERY: 'upcoming video' + }, + { + ID: 'jfKfPfyJRdk', + QUERY: 'live video' } ]; diff --git a/test/main.test.ts b/test/main.test.ts index 915f9b16..cb4f1fcf 100644 --- a/test/main.test.ts +++ b/test/main.test.ts @@ -44,6 +44,16 @@ describe('YouTube.js Tests', () => { const b_info = await yt.getBasicInfo(VIDEOS[0].ID); expect(b_info.basic_info.id).toBe(VIDEOS[0].ID); }); + + it('should be upcoming', async () => { + const b_info = await yt.getBasicInfo(VIDEOS[4].ID); + expect(b_info.basic_info.is_upcoming).toBe(true); + }); + + it('should be live', async () => { + const b_info = await yt.getBasicInfo(VIDEOS[5].ID); + expect(b_info.basic_info.is_live).toBe(true); + }); }); describe('Search', () => {