fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.48k stars 794 forks source link

Some videos shows http 403 #653

Closed batuhansahan closed 4 years ago

batuhansahan commented 4 years ago

I cannot access some spesific videos(the url shows http 403 error) - i thought this was fixed on 2.1.2 but it occured again. anyone knows what is the problem. and how to solve the problem.

example video Maroon 5 - Girls Like you

i tried every version but no help.

fent commented 4 years ago

works for me when I try it. are you using a ytdl-core wrapper like ytdl-core-discord? any other settings passed like proxy? latest is actually v3.1.1

batuhansahan commented 4 years ago

@fent no im using this library, i tried 3.1.1 but still same, i am using with express js

its working on my localhost but when i release in Google Cloud or AWS EC2 express js restfull api, its giving url but the url shows http 403 spesific videos they have sp="sig" in response json.

Nodejs Backend

  router.route('/youtube').post(async (req, res) => {
    const {link} = req.body;
      try {
        const info = await ytdl.getInfo(link);
        if (info) {
          let video = ytdl.filterFormats(info.formats, 'audioandvideo');
          if (video.length === 0) {
            video = ytdl.filterFormats(info.formats, 'videoonly');
          }
          return res.send({video: video[0].url});
    } catch ...

i think i found the problem i have to request with the client ip instead of server ip but how can i do that

fent commented 4 years ago

yep, this is under limitations