YouTube.js icon indicating copy to clipboard operation
YouTube.js copied to clipboard

13.3.0 Uplayable when download Vevo videos

Open neoxr opened this issue 9 months ago • 10 comments

Steps to reproduce

My Code :

class Youtube {
   constructor() {
      this.options = {
         cache: new UniversalCache(false),
         cookie: 'xxxxxxxxx',
         client_type: ClientType.WEB_EMBEDDED
      }

      downloadAudio = url => new Promise(async (resolve, reject) => {
         try {
            const id = this.getId(url)
            const yt = await Innertube.create(this.options)
            const stream = await yt.download(id, {
               type: 'audio',
               quality: 'best',
               format: 'mp4',
               client: 'WEB'
            })

            const fileId = Func.uuid()
            const filePath = path.join(this.dir, `${fileId}.mp3`)
            const fileStream = fs.createWriteStream(filePath)

            for await (const chunk of Utils.streamToIterable(stream)) {
               fileStream.write(chunk)
            }

            await global.db.insert('uploader', {
               code: Func.makeId(6),
               filename: `${fileId}.mp3`,
               bytes: fs.statSync(filePath).size,
               size: Func.formatSize(fs.statSync(filePath).size),
               expired_at: (new Date * 1) + 300000
            })

            const info = await this.getInfo(url)
            var data = {
               filename: info.title + '.mp3',
               quality: '128kbps',
               size: Func.formatSize(fs.statSync(filePath).size),
               extension: 'mp3',
               url: this.cdn + '/dl?token=' + Func.genTokenFromUrl(`${this.cdn}/${process.env.FILE_PATH}/${fileId}.mp3`, `y2mate.com - ${info.title + '.mp3'}`)
            }
            resolve({
               creator: global.creator,
               status: true,
               ...info,
               data
            })
         } catch (e) {
            resolve({
               creator: global.creator,
               status: false,
               msg: e.message
            })
         }
      })
   }
}

Failure Logs

InnertubeError: Video is unplayable
    at Module.download (file:///home/user/typescript/external-api/node_modules/youtubei.js/dist/src/utils/FormatUtils.js:5:15)
    at VideoInfo.download (file:///home/user/typescript/external-api/node_modules/youtubei.js/dist/src/core/mixins/MediaInfo.js:103:28)
    at Innertube.download (file:///home/user/typescript/external-api/node_modules/youtubei.js/dist/src/Innertube.js:340:21)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/user/typescript/external-api/lib/scraper/youtubei.js:50:25 {
  info: { error_type: 'UNPLAYABLE' },
  date: 2025-03-25T23:47:44.976Z,
  version: '13.3.0'
}
{ creator: undefined, status: false, msg: 'Video is unplayable' }

Expected behavior

Output as audio file

Image

Current behavior

Error : Uplayable

Image

Version

Default

Anything else?

Youtube Vevo Link : https://youtu.be/22tVWwmTie8?feature=shared

Checklist

  • [x] I am running the latest version.
  • [x] I checked the documentation and found no answer.
  • [x] I have searched the existing issues and made sure this is not a duplicate.
  • [x] I have provided sufficient information.

neoxr avatar Mar 26 '25 00:03 neoxr

I'm having the same problem.

coderonex avatar Apr 10 '25 15:04 coderonex

WEB_EMBEDDED dont work for all videos. Use WEB or TV Client

rustynail1984 avatar Apr 11 '25 12:04 rustynail1984

WEB_EMBEDDED dont work for all videos. Use WEB or TV Client I'm using the WEB client and I can get the audio and video links, but the access returns a 403 error

coderonex avatar Apr 11 '25 12:04 coderonex

WEB_EMBEDDED dont work for all videos. Use WEB or TV Client I'm using the WEB client and I can get the audio and video links, but the access returns a 403 error

You need to provide potoken if you aren’t already

2shiraz avatar Apr 11 '25 12:04 2shiraz

WEB_EMBEDDED dont work for all videos. Use WEB or TV Client I'm using the WEB client and I can get the audio and video links, but the access returns a 403 error

You need to provide potoken if you aren’t already

Yes, I provided potoken Strange thing happened, using the same cookie and potoken, it downloaded fine on my local environment (even without potoken), the same cookie and potoken, on my two different servers, it was a 403 error!

coderonex avatar Apr 11 '25 12:04 coderonex

WEB_EMBEDDED dont work for all videos. Use WEB or TV Client I'm using the WEB client and I can get the audio and video links, but the access returns a 403 error

You need to provide potoken if you aren’t already

Yes, I provided potoken Strange thing happened, using the same cookie and potoken, it downloaded fine on my local environment (even without potoken), the same cookie and potoken, on my two different servers, it was a 403 error!

Are you using onesie request? If not try with that

2shiraz avatar Apr 11 '25 13:04 2shiraz

WEB_EMBEDDED dont work for all videos. Use WEB or TV Client I'm using the WEB client and I can get the audio and video links, but the access returns a 403 error

You need to provide potoken if you aren’t already

Yes, I provided potoken Strange thing happened, using the same cookie and potoken, it downloaded fine on my local environment (even without potoken), the same cookie and potoken, on my two different servers, it was a 403 error!

Are you using onesie request? If not try with that

I tried to access the video link from the server in a local browser, and it returned a 403 error.

coderonex avatar Apr 11 '25 13:04 coderonex

I tried to access the video link from the server in a local browser, and it returned a 403 error.

Mostly the links are IP bound and will not work if you access them from a different IP.

As for the po Token and cookies,if I'm not mistaken you need to generate Po Token on the server you want to get the video on as Po Token don't work across IPS. ( I could be wrong ).

LingeringAsh avatar Apr 12 '25 00:04 LingeringAsh

I tried to access the video link from the server in a local browser, and it returned a 403 error.

Mostly the links are IP bound and will not work if you access them from a different IP.

As for the po Token and cookies,if I'm not mistaken you need to generate Po Token on the server you want to get the video on as Po Token don't work across IPS. ( I could be wrong ).

Yes, tried using the server generated potoken and still got a 403 error for the video link, could it be because the cookie is generated locally and can't be used on the server?

coderonex avatar Apr 12 '25 00:04 coderonex