Kakulukian / youtube-transcript

Fetch transcript from a youtube video
240 stars 51 forks source link

SyntaxError: Error parsing #23

Open onigetoc opened 4 months ago

onigetoc commented 4 months ago

i got this error: SyntaxError: Error parsing /home/runner/Youtube-transcript/package.json: Unexpected non-whitespace character after JSON at position 168

node:internal/modules/package_json_reader:93
        throw error;
        ^

SyntaxError: Error parsing /home/runner/Youtube-transcript/package.json: Unexpected non-whitespace character after JSON at position 168
    at parse (<anonymous>)
    at read (node:internal/modules/package_json_reader:80:16)
    at readPackage (node:internal/modules/package_json_reader:141:10)
    at readPackageScope (node:internal/modules/package_json_reader:164:19)
    at shouldUseESMLoader (node:internal/modules/run_main:72:15)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:129:24)
    at node:internal/main/run_main_module:28:49 {
  path: '/home/runner/Youtube-transcript/package.json'
}

Node.js v20.11.1

package.json

{
  "name": "nodejs",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/node": "^18.0.6"
  }
}

index.js

import { YoutubeTranscript } from 'youtube-transcript';

// URL OR ID OF THE VIDEO
YoutubeTranscript.fetchTranscript('https://www.youtube.com/watch?v=ZdrZf4lQTSg').then(console.log);
ericmmartin commented 3 months ago

I'm using the same version of node and don't have any issues running the sample you provided. 🤔