joshunrau / ytdl-mp3

An npm package to facilitate downloading music from YouTube, including automatic retrieval of ID3 tags and album art via the iTunes public API
https://www.npmjs.com/package/ytdl-mp3
MIT License
24 stars 12 forks source link

Error: Invalid response #1

Closed dench1k closed 2 years ago

dench1k commented 2 years ago

Hey, Joshua, the issue with downloading appeared a couple days ago. I updated the package for the newest version, here's the stack trace:

ytdl-mp3 https://www.youtube.com/watch?v=7TREIsVM08Q Unable to extract all song tags from YouTube Enter title: C:\Users\admin\AppData\Roaming\npm\node_modules\ytdl-mp3\src\utils.js:26 reject(new Error('Invalid response: ' + response)); ^

Error: Invalid response: at C:\Users\admin\AppData\Roaming\npm\node_modules\ytdl-mp3\src\utils.js:26:24 at [_onLine] [as _onLine] (node:internal/readline/interface:422:7) at [_line] [as _line] (node:internal/readline/interface:885:18) at [_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1263:22) at ReadStream.onkeypress (node:internal/readline/interface:272:20) at ReadStream.emit (node:events:527:28) at emitKeys (node:internal/readline/utils:358:14) at emitKeys.next () at ReadStream.onData (node:internal/readline/emitKeypressEvents:64:36) at ReadStream.emit (node:events:527:28)

Node.js v18.0.0

I use windows 10.

The error occurs if the "Enter title:" or "Enter artist:" is empty. Before that it worked like a charm if I left them empty. Do you have any suggestions about this problem?

joshunrau commented 2 years ago

Hey, so yesterday I tried to download something and got this error, which appears to be a problem with the ytdl-core library. In addition, the method I was using to fetch metadata for the songs is now useless due to a change in the YouTube API which was causing me to be prompted to enter the details each time. So, I made a number of changes (including rolling back the ytdl-core version) which might have broken this. I am going to look into this tomorrow, write some tests, and then push a fix.

dench1k commented 2 years ago

Thank you for the answering, will wait for update!

joshunrau commented 2 years ago

Hey, no worries! So I made some major updates, since the changes YouTube made broke the (easier) way of getting the tags. Now, they are fetched from iTunes based on the video title, so it should actually work now unlike the previous method. However, if you don't want to add any tags, I added an option ("-n") that you can add and then it should skip adding or fetching any tags. Let me know if there are any other issues :)

dench1k commented 2 years ago

Cool, that's nice to hear. I will check out the update in the evening and test things out. Thank you for your fast reply and solution!