diff --git a/src/services/youtube-api.ts b/src/services/youtube-api.ts index 944d4d8..47b91d8 100644 --- a/src/services/youtube-api.ts +++ b/src/services/youtube-api.ts @@ -74,7 +74,7 @@ export default class { } async search(query: string, shouldSplitChapters: boolean): Promise { - const {items}: ytsr.VideoResult | void = await this.ytsrQueue.add(async () => this.cache.wrap( + const result = await this.ytsrQueue.add(async () => this.cache.wrap( ytsr, query, { @@ -85,13 +85,13 @@ export default class { }, )); - if (!items) { + if (result === undefined) { return []; } let firstVideo: Video | undefined; - for (const item of items) { + for (const item of result.items) { if (item.type === 'video') { firstVideo = item; break;