fix(route/youtube): ensure youtubei is not invoked when using google api (#20465)

This commit is contained in:
Tony
2025-11-11 15:27:47 +08:00
committed by GitHub
parent 36fce5a981
commit dac672d3bb
3 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -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;
+1 -1
View File
@@ -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,
+2 -1
View File
@@ -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;