UNPKG

rsshub

Version:
71 lines (69 loc) 2.39 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import { t as ViewType } from "./types-gOySfSXJ.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import "./cache-SV6W5EPy.mjs"; import { a as callApi, r as getDataByUsername } from "./google-CvcgN7WE.mjs"; import { r as getDataByUsername$1 } from "./youtubei-DqP__aN-.mjs"; //#region lib/routes/youtube/user.ts const route = { path: "/user/:username/:routeParams?", categories: ["social-media"], view: ViewType.Videos, example: "/youtube/user/@JFlaMusic", parameters: { username: "YouTuber handle with @", routeParams: "Extra parameters, see the table below" }, description: `::: tip Parameter | Name | Description | Default | | ---------- | ----------------------------------------------------------------------------------- | ------- | | embed | Whether to embed the video, fill in any value to disable embedding | embed | | filterShorts | Whether to filter out shorts from the feed, fill in any falsy value to show shorts | true | :::`, features: { requireConfig: [{ name: "YOUTUBE_KEY", description: " YouTube API Key, support multiple keys, split them with `,`, [API Key application](https://console.developers.google.com/)", optional: true }], requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: [ "www.youtube.com/user/:username", "www.youtube.com/:username", "www.youtube.com/:username/videos" ], target: "/user/:username" }], name: "Channel with user handle", maintainers: ["DIYgod", "pseudoyu"], handler }; async function handler(ctx) { const username = ctx.req.param("username"); const routeParams = ctx.req.param("routeParams"); const params = new URLSearchParams(routeParams); const embed = !params.get("embed"); const filterShortsStr = params.get("filterShorts"); return await callApi({ googleApi: getDataByUsername, youtubeiApi: getDataByUsername$1, params: { username, embed, filterShorts: filterShortsStr === null || filterShortsStr === "" || filterShortsStr === "true", isJsonFeed: ctx.req.query("format") === "json" } }); } //#endregion export { route };