Closed gurusabarishh closed 4 years ago
hmm, did you modify the code? I tried converting the URL with a fresh clone of the code and it works as I expected for me. If you have modified it can you show me?
Thanks for your reply @Moorad But, I didn't modify the code. I guess the problem is runing the server at port 4000. I just run the index file in my local pc server. You can view that in search box of the above image.
Could you tell me "How to run the npm server at port 4000 after the node index.js comment" ?
I don't think the issue is related to the port. Running node index.js
should run the server on port 4000 automatically (because it's hardcoded in the code. You can look at line 5 in index.js.) and the index.html is already setup so that it redirects you to localhost:4000
(:4000
means port 4000).
If the port was indeed in use by another application or service you should get an error similar to
The problem is most likely related to (This is on lines 18-22)
await ytdl.getBasicInfo(url, {
format: 'mp4'
}, (err, info) => {
title = info.player_response.videoDetails.title.replace(/[^\x00-\x7F]/g, "");
});
Currently any errors that ytdl throws are ignored. Try replacing the above with
await ytdl.getBasicInfo(url, {
format: 'mp4'
}, (err, info) => {
if (err) throw err;
title = info.player_response.videoDetails.title.replace(/[^\x00-\x7F]/g, "");
});
This should output any errors that occur during the execution of ytdl.getBasicInfo()
. Try that and show me if any new errors appear
Now I got the error in getBasicInfo.
Hmm what version of ytdl-core do you have? You can find the version in package.json in dependencies
I have the ytdl-core: ^2.0.0. This is my Package file.
Ok according to this https://github.com/fent/node-ytdl-core/issues/585#issuecomment-636081145 the latest version fixes the JSON problem. I also have version 2.0.0 but I don't have the same problem for some reason.
Running
npm i ytdl-core@latest
in the Server folder should fix the problem
let me know if you still have the problem
Thanks for your help to fix. Now, Its works super cool :)
I just paste this link https://www.youtube.com/watch?v=ryD8BqVexJI&list=RDryD8BqVexJI&start_radio=1 and press the convert button with mp3. But, its running more then 10 minutes and i got the TypeError in my windows terminal like that image.
Could you help me to find the error?