fix for `compactVideoRenderer` related errors

This commit is contained in:
Kenny 2022-03-04 09:13:05 -05:00
parent 66a1704fb8
commit de3e92dc7a
1 changed files with 11 additions and 9 deletions

View File

@ -86,15 +86,17 @@ const module = {
let results = new Array();
youtubeSearch(text, (videos) => {
for (const i in videos) {
const video = videos[i];
results.push({
id: video.compactVideoRenderer.videoId,
runtime: video.compactVideoRenderer.lengthText.runs[0].text,
uploaded: video.compactVideoRenderer.publishedTimeText.runs[0].text,
views: video.compactVideoRenderer.viewCountText.runs[0].text,
thumbnails: video.compactVideoRenderer.thumbnail.thumbnails,
raw: video
})
if (video.compactVideoRenderer) {
const video = videos[i];
results.push({
id: video.compactVideoRenderer.videoId,
runtime: video.compactVideoRenderer.lengthText.runs[0].text,
uploaded: video.compactVideoRenderer.publishedTimeText.runs[0].text,
views: video.compactVideoRenderer.viewCountText.runs[0].text,
thumbnails: video.compactVideoRenderer.thumbnail.thumbnails,
raw: video
})
}
}
})
callback(results);