fix(route/youtube): ensure youtubei is not invoked when using google api (#20465)
This commit is contained in:
@@ -65,10 +65,12 @@ async function handler(ctx) {
|
||||
throw new InvalidParameterError(`Invalid YouTube channel ID. \nYou may want to use <code>/youtube/user/:id</code> instead.`);
|
||||
}
|
||||
|
||||
const isJsonFeed = ctx.req.query('format') === 'json';
|
||||
|
||||
const data = await callApi({
|
||||
googleApi: getDataByChannelIdGoogle,
|
||||
youtubeiApi: getDataByChannelIdYoutubei,
|
||||
params: { channelId: id, embed, filterShorts },
|
||||
params: { channelId: id, embed, filterShorts, isJsonFeed },
|
||||
});
|
||||
|
||||
return data;
|
||||
|
||||
@@ -16,7 +16,7 @@ export const route: Route = {
|
||||
requireConfig: [
|
||||
{
|
||||
name: 'YOUTUBE_KEY',
|
||||
description: ' YouTube API Key, support multiple keys, split them with `,`, [API Key application](https://console.developers.google.com/)',
|
||||
description: 'YouTube API Key, support multiple keys, split them with `,`, [API Key application](https://console.developers.google.com/)',
|
||||
},
|
||||
],
|
||||
requirePuppeteer: false,
|
||||
|
||||
@@ -31,11 +31,12 @@ export const route: Route = {
|
||||
async function handler(ctx) {
|
||||
const id = ctx.req.param('id');
|
||||
const embed = !ctx.req.param('embed');
|
||||
const isJsonFeed = ctx.req.query('format') === 'json';
|
||||
|
||||
const data = await callApi({
|
||||
googleApi: getDataByPlaylistIdGoogle,
|
||||
youtubeiApi: getDataByPlaylistIdYoutubei,
|
||||
params: { playlistId: id, embed },
|
||||
params: { playlistId: id, embed, isJsonFeed },
|
||||
});
|
||||
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user