Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5130a4e37 | ||
|
|
296ceb3fd4 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -586,7 +586,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.1.tgz",
|
||||||
"integrity": "sha512-KsFcH0xxHes0J4zaQgWbYwmz3UPOOskdqZmItstUG93+Wk1ePBLkLGwbP9zlmh1BFUiL8Qp+Xfu9P7feJWpGNg==",
|
"integrity": "sha512-KsFcH0xxHes0J4zaQgWbYwmz3UPOOskdqZmItstUG93+Wk1ePBLkLGwbP9zlmh1BFUiL8Qp+Xfu9P7feJWpGNg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.9.0"
|
"node": ">=16.9.0"
|
||||||
}
|
}
|
||||||
@ -669,7 +668,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/zod/-/zod-4.2.1.tgz",
|
||||||
"integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==",
|
"integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/colinhacks"
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/api/accounts.ts
Normal file
14
src/api/accounts.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { Hono } from "hono";
|
||||||
|
import { randomBytes } from "node:crypto"
|
||||||
|
|
||||||
|
const accounts = new Hono();
|
||||||
|
|
||||||
|
accounts.post(
|
||||||
|
"/registerDevice",
|
||||||
|
(c) => {
|
||||||
|
const key = randomBytes(16).toString("hex");
|
||||||
|
return c.text(`DeviceId=${key}\nDeviceKey=${key}`)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default accounts
|
||||||
@ -8,8 +8,9 @@ import type { YT } from "youtubei.js";
|
|||||||
|
|
||||||
const feed = new Hono();
|
const feed = new Hono();
|
||||||
|
|
||||||
feed.get(
|
feed.on(
|
||||||
"/standardfeeds/:region/:type",
|
"GET",
|
||||||
|
["/standardfeeds/:region/:type", "/standardfeeds/:type"],
|
||||||
zValidator("param", FeedGetSchema),
|
zValidator("param", FeedGetSchema),
|
||||||
async (c) => {
|
async (c) => {
|
||||||
const { type } = c.req.valid("param");
|
const { type } = c.req.valid("param");
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import video from "./api/video.js"
|
|||||||
import playback from "./api/playback.js"
|
import playback from "./api/playback.js"
|
||||||
import channel from "./api/channel.js"
|
import channel from "./api/channel.js"
|
||||||
import feed from "./api/feed.js"
|
import feed from "./api/feed.js"
|
||||||
|
import accounts from "./api/accounts.js"
|
||||||
|
|
||||||
const app = new Hono()
|
const app = new Hono()
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ app.route("/getvideo", playback);
|
|||||||
app.route("/feeds/api", video);
|
app.route("/feeds/api", video);
|
||||||
app.route("/feeds/api", channel);
|
app.route("/feeds/api", channel);
|
||||||
app.route("/feeds/api", feed);
|
app.route("/feeds/api", feed);
|
||||||
|
app.route("/youtube/accounts", accounts);
|
||||||
|
|
||||||
serve({
|
serve({
|
||||||
fetch: app.fetch,
|
fetch: app.fetch,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
export const FeedGetSchema = z.object({
|
export const FeedGetSchema = z.object({
|
||||||
region: z.string().length(2),
|
region: z.string().length(2).optional(),
|
||||||
type: z.enum(["most_popular", "most_popular_Film", "most_popular_Games", "most_popular_Music"])
|
type: z.enum(["most_popular", "most_popular_Film", "most_popular_Games", "most_popular_Music"])
|
||||||
});
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user