import { prisma } from "../lib/db";
import { search } from "../lib/threads-browser/search";

async function main() {
  const account = await prisma.account.findFirst({ orderBy: { updatedAt: "desc" } });
  if (!account) {
    console.log("No account");
    return;
  }
  const results = await search(account.storageState, "備孕", 20);
  console.log("Results:", results.length);
  for (const r of results.slice(0, 5)) {
    console.log("-", r.authorName, r.text.slice(0, 60), "likes:", r.likeCount);
  }
}

main().catch(console.error);