Skip to content

Commit 71acbf8

Browse files
committed
Cast videoData to YTResponse for type safety
1 parent 344cc98 commit 71acbf8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/utils/youtube.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import ytdl_dlp from './yt-dlp.js';
22
import logger from './logger.js';
33
import yts from 'play-dl';
4-
import { YouTubeVideo } from '../@types/index.js';
4+
import { YouTubeVideo, YTResponse } from '../@types/index.js';
55

66
export class Youtube {
77
async getVideoInfo(url: string): Promise<YouTubeVideo | null> {
88
try {
9-
const videoData = await ytdl_dlp(url, { dumpSingleJson: true, noPlaylist: true });
9+
const videoData = await ytdl_dlp(url, { dumpSingleJson: true, noPlaylist: true }) as YTResponse;
1010

1111
if (typeof videoData === 'object' && videoData !== null && videoData.id && videoData.title) {
1212
return {
1313
id: videoData.id,
1414
title: videoData.title,
1515
formats: [],
1616
videoDetails: {
17-
isLiveContent: videoData.is_live === true || videoData.live_status === 'is_live'
17+
isLiveContent: videoData.is_live === true || (videoData as any).live_status === 'is_live'
1818
}
1919
};
2020
}

0 commit comments

Comments
 (0)