ytdl-js / react-native-ytdl

A YouTube downloader for React Native
120 stars 46 forks source link

Error: This video is unavailable #14

Open bougarfaoui opened 4 years ago

bougarfaoui commented 4 years ago

Hi thanks for this amazing repo, this library works for some video ids but when I used this id : GBfJIxe3vyQ it throws an error. here's the code :

      ytdl.getInfo('GBfJIxe3vyQ', {}, (err, info) => {
        if (err) {console.warn(err); return;}
        let audioFormats = ytdl.filterFormats(info.formats, 'video');
        ...
      });

here's the error : [Error: This video is unavailable]

this video id GBfJIxe3vyQ works fine with node-ytdl-core library.

Please someone fix this.

vht090 commented 4 years ago
  1. at info.js, line 106, edit function parseFormats `const parseFormats = (info) => {

    const streamingData = info.player_response.streamingData;

    const formats = [];

    streamingData.adaptiveFormats.map(format => { const cipher = querystring.parse(format.cipher) formats.push({ ...format, ...cipher }) }) return formats; }; `

  2. file util.js, line 36, const getBitrate....., edit to: const getBitrate = (c) => { if (typeof c.bitrate === 'string') { let s = c.bitrate.split('-'); return parseFloat(s[s.length - 1], 10); } else if (typeof c.bitrate === 'number') { return c.bitrate; } else { return 0; } };
bougarfaoui commented 4 years ago

thanks. I hope someone merge it with the master

AbelTesfaye commented 4 years ago

Hi @bougarfaoui,

Is this issue fixed in the new release?

umithyo commented 4 years ago

The issue seems to persist for me after the update.

AbelTesfaye commented 4 years ago

The issue seems to persist for me after the update.

I don't understand whats causing this problem. Are you sure the node ytdl library works with the YouTube video id you're testing? (please send the videoId as well so I can debug with it)

umithyo commented 4 years ago

The issue seems to persist for me after the update.

I don't understand whats causing this problem. Are you sure the node ytdl library works with the YouTube video id you're testing? (please send the videoId as well so I can debug with it)

Hello, thanks for your reply. It happened with every youtube video the last I tried. I had to start using a different streaming service for the videos.

AbelTesfaye commented 4 years ago

@umithyo that's strange. Could the issue be with your client-side configurations? Maybe a bad VPN, firewall or proxy setting?

umithyo commented 4 years ago

@umithyo that's strange. Could the issue be with your client-side configurations? Maybe a bad VPN, firewall or proxy setting?

I'm sorry for the late reply, I have been using a different video service since I had to fix the problem quickly. It might be a clientside issue, I'm not so sure now. All I know is, it has been working without any problems until the last update.

we-over-i commented 4 years ago

I'm having the same problem. Surprisingly it only happens when I'm on data. On my home's wifi everything works fine.

@umithyo which service are you using now?

umithyo commented 4 years ago

Hello @we-over-i My app heavily depended on weekly cycled videos so, admin user inputs a video id on an angular app, I download the video with https://www.npmjs.com/package/ytdl-core on a dedicated server, then fetch the video when in need. It might not be optimal for every system but it fits my need.