naseif / tiktok-scraper

Scraper for TikTok. Download videos, music, fetch users info and more.
https://naseif.github.io/tiktok-scraper/
MIT License
90 stars 25 forks source link

playwright-core Module parse failed: Unexpected character '' #23

Open andronesh opened 1 year ago

andronesh commented 1 year ago

Trying to fetch video info from Next.js router:

import { fetchVideo } from "tiktok-scraper-ts";

export async function GET(request: NextRequest, response: NextResponse) {
  try {
    const link =
      "https://www.tiktok.com/@colouredhorses/video/7239893633372114183";
    const video = await fetchVideo(link);
    return NextResponse.json(video, { status: 200 });
  } catch (e) {
    console.error(`Error while trying to get video info`, e);
    return NextResponse.json(
      { error: "Something went wrong." },
      { status: 500 }
    );
  }
}

but it fails with error:

- error ./node_modules/playwright-core/lib/webpack/recorder/assets/codicon-dcd00fb4.ttf
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

Import trace for requested module:
./node_modules/playwright-core/lib/webpack/recorder/assets/codicon-dcd00fb4.ttf
./node_modules/playwright-core/lib/webpack/recorder/ sync ^\.\/.*$
./node_modules/playwright-core/lib/server/recorder/recorderApp.js
./node_modules/playwright-core/lib/server/debugController.js
./node_modules/playwright-core/lib/server/playwright.js
./node_modules/playwright-core/lib/server/index.js
./node_modules/playwright-core/lib/inProcessFactory.js
./node_modules/playwright-core/lib/inprocess.js
./node_modules/playwright-core/index.js
./node_modules/playwright-chromium/index.js
./node_modules/tiktok-signature/index.js
./node_modules/tiktok-scraper-ts/dist/main.js
./src/app/api/imports/route.ts