Skip to content

Commit

Permalink
fix: no lodash in edge runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 2, 2023
1 parent 66514ef commit 8539b8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/api/summarize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { find } from "lodash";
import find from "lodash";
import { NextResponse } from "next/server";
import { Redis } from "@upstash/redis";
import type { NextFetchEvent, NextRequest } from "next/server";
Expand Down Expand Up @@ -40,7 +40,9 @@ export default async function handler(
if (subtitleList && subtitleList.length < 1) {
return new Response("No subtitle in the video", { status: 501 });
}
const betterSubtitle = find(subtitleList, { lan: "zh-CN" }) || subtitleList?.[0]
const betterSubtitle =
subtitleList.find(({ lan }: { lan: string }) => lan === "zh-CN") ||
subtitleList?.[0];
const subtitleUrl = betterSubtitle?.subtitle_url;
console.log("bvid", bvId);
console.log("subtitle_url", subtitleUrl);
Expand Down

1 comment on commit 8539b8a

@vercel
Copy link

@vercel vercel bot commented on 8539b8a Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.