Merge pull request #358 from Hellysonrp/fix-playlist-load

This commit is contained in:
Max Isom 2021-09-23 13:06:01 -04:00 committed by GitHub
commit a8676e6ebd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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,
}, },