fent / fent/node-ytdl-core

SyntaxError: Invalid or unexpected token

Open
#1,261 19 comments 19 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.7k
Forks
852
PR merge metrics
No merged PRs in 30d

Description

I was working on a project, when suddently, ytdl-core stoped working. So i created a new project to try a simple code:
```js
const fs = require('fs');
const ytdl = require('ytdl-core');

const url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';

ytdl(url)
.pipe(fs.createWriteStream('video.mp4'));
```
I have the latest package of ytdl: `ytdl-core@4.11.5`

But when i run the code: `node index.js,` i get the error:
```sh
evalmachine.:426
koa=function(a,b,c,d){var e=null;switch(b){case "JSON":try{var f=c.responseText}catch(h){throw d=Error("Error reading responseText"),d.params=a,JB(d),h;}a=c.getResponseHeader("Content-Type")||"";f&&0<=a.indexOf("json")&&(")]};gma(ncode);
^^^^^^^^^^^^^^^^

SyntaxError: Invalid or unexpected token
at new Script (node:vm:94:7)
at exports.decipherFormats (/tmp/test/node_modules/ytdl-core/lib/sig.js:116:51)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async exports.getInfo (/tmp/test/node_modules/ytdl-core/lib/info.js:401:17)
Emitted 'error' event on PassThrough instance at:
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.17.1
```

I'm not sure what appened, but it was working just fine, and suddently, this appear out of knowhere, without modifying anything.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.