import { zValidator } from "@hono/zod-validator"; import { Hono } from "hono"; import innertube from "../lib/innertube.js"; import homeFeed from "../templates/homeFeed.js"; import { FeedGetSchema } from "../models/FeedGetSchema.js"; import { parseHomeFeed } from "../lib/utils/feed.js"; import type { YT } from "youtubei.js"; const feed = new Hono(); feed.get( "/standardfeeds/:region/:type", zValidator("param", FeedGetSchema), async (c) => { const { type } = c.req.valid("param"); if (type != "most_popular") return c.html(homeFeed()) const data = await innertube.getHomeFeed(); const feed = data as YT.HomeFeed; return c.html(homeFeed(await parseHomeFeed(feed))) } ) export default feed