fix: playlist load, cache key

Fixes #357
This commit is contained in:
Hellyson Rodrigo Parteka 2021-09-23 00:41:26 -03:00
parent b5bb465cdc
commit 3f210c53f4
No known key found for this signature in database
GPG key ID: 3055745CA21934C7

View file

@ -139,18 +139,20 @@ export default class {
// Start fetching extra details about videos // Start fetching extra details about videos
videoDetailsPromises.push((async () => { videoDetailsPromises.push((async () => {
// Unfortunately, package doesn't provide a method for this // Unfortunately, package doesn't provide a method for this
const p = {
searchParams: {
part: 'contentDetails',
id: items.map(item => item.contentDetails.videoId).join(','),
key: this.youtubeKey,
responseType: 'json',
},
};
const {items: videoDetailItems} = await this.cache.wrap( const {items: videoDetailItems} = await this.cache.wrap(
async () => got( async () => got(
'https://www.googleapis.com/youtube/v3/videos', 'https://www.googleapis.com/youtube/v3/videos',
{ p,
searchParams: {
part: 'contentDetails',
id: items.map(item => item.contentDetails.videoId).join(','),
key: this.youtubeKey,
responseType: 'json',
},
},
).json() as Promise<{items: VideoDetailsResponse[]}>, ).json() as Promise<{items: VideoDetailsResponse[]}>,
p,
{ {
expiresIn: ONE_MINUTE_IN_SECONDS, expiresIn: ONE_MINUTE_IN_SECONDS,
}, },