Skip to content

Commit fc3025d

Browse files
committed
fix: fix getting some properties in videoDetails
the endpoint changes from the previous commit also help with this fix closes #800 closes #809
1 parent 4167c31 commit fc3025d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/info-extras.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ exports.getAuthor = info => {
109109
}
110110
try {
111111
let videoDetails = info.player_response.microformat && info.player_response.microformat.playerMicroformatRenderer;
112-
let id = videoDetails ? videoDetails.channelId : channelId;
112+
let id = (videoDetails && videoDetails.channelId) || channelId || info.player_response.videoDetails.channelId;
113113
let author = {
114114
id: id,
115115
name: videoDetails ? videoDetails.ownerChannelName : info.player_response.videoDetails.author,
@@ -121,7 +121,9 @@ exports.getAuthor = info => {
121121
verified,
122122
subscriber_count: subscriberCount,
123123
};
124-
utils.deprecate(author, 'avatar', author.thumbnails[0].url, 'author.avatar', 'author.thumbnails[0].url');
124+
if (thumbnails.length) {
125+
utils.deprecate(author, 'avatar', author.thumbnails[0].url, 'author.avatar', 'author.thumbnails[0].url');
126+
}
125127
return author;
126128
} catch (err) {
127129
return {};
File renamed without changes.

typings/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ declare module 'ytdl-core' {
146146
id: string;
147147
name: string;
148148
avatar: string; // to remove later
149-
thumbnails: thumbnail[];
149+
thumbnails?: thumbnail[];
150150
verified: boolean;
151151
user?: string;
152152
channel_url: string;
153153
external_channel_url?: string;
154154
user_url?: string;
155-
subscriber_count: number;
155+
subscriber_count?: number;
156156
}
157157

158158
interface MicroformatRenderer {

0 commit comments

Comments
 (0)