Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 Statys #434

Closed
HeadTriXz opened this issue Jun 11, 2019 · 26 comments
Closed

403 Statys #434

HeadTriXz opened this issue Jun 11, 2019 · 26 comments
Labels
stale Issues that were closed for inactivity

Comments

@HeadTriXz
Copy link

Hi, I was getting this error everytime when I try to play music on my discord bot.

2019-06-11T09:46:23.752174+00:00 app[worker.1]: events.js:170
2019-06-11T09:46:23.752194+00:00 app[worker.1]: throw er; // Unhandled 'error' event
2019-06-11T09:46:23.752196+00:00 app[worker.1]: ^
2019-06-11T09:46:23.752198+00:00 app[worker.1]:
2019-06-11T09:46:23.752201+00:00 app[worker.1]: Error: Status code: 403
2019-06-11T09:46:23.752203+00:00 app[worker.1]: at ClientRequest.httpLib.get (/app/node_modules/miniget/lib/index.js:123:19)
2019-06-11T09:46:23.752205+00:00 app[worker.1]: at Object.onceWrapper (events.js:281:20)
2019-06-11T09:46:23.752208+00:00 app[worker.1]: at ClientRequest.emit (events.js:193:13)
2019-06-11T09:46:23.752210+00:00 app[worker.1]: at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:560:23)
2019-06-11T09:46:23.752212+00:00 app[worker.1]: at HTTPParser.parserOnHeadersComplete (_http_common.js:113:17)
2019-06-11T09:46:23.752215+00:00 app[worker.1]: at TLSSocket.socketOnData (_http_client.js:447:22)
2019-06-11T09:46:23.752217+00:00 app[worker.1]: at TLSSocket.emit (events.js:193:13)
2019-06-11T09:46:23.752219+00:00 app[worker.1]: at addChunk (_stream_readable.js:295:12)
2019-06-11T09:46:23.752221+00:00 app[worker.1]: at readableAddChunk (_stream_readable.js:276:11)
2019-06-11T09:46:23.752223+00:00 app[worker.1]: at TLSSocket.Readable.push (_stream_readable.js:231:10)
2019-06-11T09:46:23.752225+00:00 app[worker.1]: Emitted 'error' event at:
2019-06-11T09:46:23.752227+00:00 app[worker.1]: at errorOrDestroy (internal/streams/destroy.js:107:12)
2019-06-11T09:46:23.752229+00:00 app[worker.1]: at PassThrough.onerror (_stream_readable.js:729:7)
2019-06-11T09:46:23.752231+00:00 app[worker.1]: at PassThrough.emit (events.js:193:13)
2019-06-11T09:46:23.752233+00:00 app[worker.1]: at PassThrough.req.prependListener (/app/node_modules/ytdl-core/lib/index.js:131:14)
2019-06-11T09:46:23.752235+00:00 app[worker.1]: at PassThrough.emit (events.js:193:13)
2019-06-11T09:46:23.752237+00:00 app[worker.1]: at ClientRequest.httpLib.get (/app/node_modules/miniget/lib/index.js:127:18)
2019-06-11T09:46:23.752239+00:00 app[worker.1]: at Object.onceWrapper (events.js:281:20)
2019-06-11T09:46:23.752241+00:00 app[worker.1]: [... lines matching original stack trace ...]
2019-06-11T09:46:23.752243+00:00 app[worker.1]: at HTTPParser.parserOnHeadersComplete (_http_common.js:113:17)

@MidSpike
Copy link

Confirmed Issue started appearing recently
Error: Status code: 403 at ClientRequest.httpLib.get (C:\Users\tyler\Desktop\midspike-discord-sync\node_modules\miniget\lib\index.js:123:19) at Object.onceWrapper (events.js:273:13) at ClientRequest.emit (events.js:182:13) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21) at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17) at TLSSocket.socketOnData (_http_client.js:442:20) at TLSSocket.emit (events.js:182:13) at addChunk (_stream_readable.js:283:12) at readableAddChunk (_stream_readable.js:264:11) at TLSSocket.Readable.push (_stream_readable.js:219:10) at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) Emitted 'error' event at: at PassThrough.onerror (_stream_readable.js:690:12) at PassThrough.emit (events.js:182:13) at PassThrough.req.prependListener (C:\Users\tyler\Desktop\midspike-discord-sync\node_modules\ytdl-core\lib\index.js:131:14) at PassThrough.emit (events.js:182:13) at ClientRequest.httpLib.get (C:\Users\tyler\Desktop\midspike-discord-sync\node_modules\miniget\lib\index.js:127:18) at Object.onceWrapper (events.js:273:13) [... lines matching original stack trace ...] at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

@chees-e
Copy link

chees-e commented Jun 12, 2019

Experiencing the same issue, don't know why. It seems like it's only a problem with popular/big videos. I have a song uploaded to Youtube with little views and it worked for that song. Maybe it is an issue with Youtube.

I am not an experienced coder but for now, you can handle this error by
ytdl(url, { filter: "audio" }).on('error', e=>console.log(e))
when creating the stream.

@LevitatingBusinessMan
Copy link
Contributor

I am also getting 403 errors, on all video's....

@benkaiser
Copy link

Could be related: ytdl-org/youtube-dl#21218

Basically in my case I'm getting 403s, but it may be due to the fact I'm extracting the download URL and then passing it to a client which is then failing to load the URL (i.e. youtube is blocking that).

@HeadTriXz
Copy link
Author

Solution: Update simple-youtube-api (If you are using it)

@benkaiser
Copy link

@HeadTriXz how is that solution to people faced with the issue in this library? the have no dependency between each other?

@LevitatingBusinessMan
Copy link
Contributor

Ye I don't see how simple-youtube-api relates at all.

@chees-e
Copy link

chees-e commented Jun 13, 2019

I hope the developers will look into this problem soon, but for now, you may consider using youtube-dl:

const youtubedl = require('youtube-dl');
const audio = youtubedl(url,
  ['-x', '--audio-format', 'mp3'],
  { cwd: __dirname });
 
audio.pipe(fs.createWriteStream('audio.mp3'))

@PLASMAchicken
Copy link

Can you try to do npm i fent/node-ytdl-core

@Meteusz
Copy link

Meteusz commented Jun 14, 2019

@PLASMAchicken Still same 403 error.

@tsrubar
Copy link

tsrubar commented Jun 14, 2019

At my job, we ran npm i fent/node-ytdl-core as user volumio, so we got ytdl-core@0.29.2. Then as root edited /data/plugins/music_service/youtube/package.json line 18 to same version "ytdl-core": "^0.29.2", then removed whole node_modules folder, then npm install. After reboot it was working nicely again

@motorlatitude
Copy link

I think this was fixed in 1f79df3 and merged (#428). Installing ytdl-core@0.29.2 fixes this issue for me for now.

@NegativeIQ
Copy link

Yep seems like updating to 0.29.2 does the trick

@UraYukimitsu
Copy link

@tsrubar
Copy link

tsrubar commented Jun 14, 2019

I will try them on monday on our volumio

@BrunoMoreira99
Copy link
Contributor

I use my music bot very regularly and I haven't had any 403 error since 0.29.2.
Make sure you're actually on 0.29.2, delete your node_modules folder and run npm install if you have to.

@motorlatitude
Copy link

@UraYukimitsu I tried all 3 of those and they work fine for me?

@benkaiser
Copy link

As per my previous comment:

Could be related: ytdl-org/youtube-dl#21218

It looks like it could be this is only occurring when the machine trying to download the url is different to the one that gets the URL (i.e youtube is locking the urls down to the IPs that requested them).

@kartik1225
Copy link

@motorlatitude still getting 403 on 0.29.2 on this link

@motorlatitude
Copy link

@kartik1225 That link also works fine for me on 0.29.2, your issue could be related to what @benkaiser mentioned?

@kartik1225
Copy link

@motorlatitude this will work fine if you are testing this on the localhost. because the ip will be the same but that same link might not work on the different ip (device).

@motorlatitude
Copy link

@kartik1225 sorry, I should have specified, I tested on my remote server using my discord bot. The URL issue mentioned previously is with reference to the download URL which is separate to the link you provided I believe.

For example, if I run;

$ youtube-dl -g https://www.youtube.com/watch?v=PT2_F-1esPk

I will get these download URLs;

https://r1---sn-3xtjvh-ac5e.googlevideo.com/videoplayback?expire=1560912108&ei=i0wJXaHANsSnVtX0gogK&ip=109.246.19.50&id=o-AH-_u7BSGz0QUhmF9snvUxn2V7S9RTOD-L62NT5wIwKm&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397%2C398&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-3xtjvh-ac5e%2Csn-aigzrn7z&ms=au%2Crdu&mv=m&pl=20&gcr=gb&initcwndbps=1361250&mime=video%2Fmp4&gir=yes&clen=104491761&dur=261.803&lmt=1556983934018483&mt=1560890410&fvip=1&keepalive=yes&c=WEB&txp=5535432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cgcr%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cpl%2Cinitcwndbps&lsig=AHylml4wRAIgSKOViPZ6VZCC24LBGv84XETl1SqkiAMcs3Jt7ad9StkCIE1fnTCtHWA4LGKPho198JTBytIBMVsNQMleysD9uXNs&sig=ALgxI2wwRAIgWoMyIOPaoZZTeFlaTBJtcuaBUhMOwNg3kcct3N7TzEACIEabXEUKII7ktCAgYCCLaYDOJ_pPkY7IWvFdofZU_1ab&ratebypass=yes
https://r1---sn-3xtjvh-ac5e.googlevideo.com/videoplayback?expire=1560912108&ei=i0wJXaHANsSnVtX0gogK&ip=109.246.19.50&id=o-AH-_u7BSGz0QUhmF9snvUxn2V7S9RTOD-L62NT5wIwKm&itag=251&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-3xtjvh-ac5e%2Csn-aigzrn7z&ms=au%2Crdu&mv=m&pl=20&gcr=gb&initcwndbps=1361250&mime=audio%2Fwebm&gir=yes&clen=4348334&dur=261.821&lmt=1540261587251261&mt=1560890410&fvip=1&keepalive=yes&c=WEB&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cpl%2Cinitcwndbps&lsig=AHylml4wRAIgSKOViPZ6VZCC24LBGv84XETl1SqkiAMcs3Jt7ad9StkCIE1fnTCtHWA4LGKPho198JTBytIBMVsNQMleysD9uXNs&sig=ALgxI2wwRgIhAPrFih6EoNMrLLcBxoU5h6pxp1eIelLGHus71RIVm6INAiEAzECJLuwwKQuMH_QKCFZX-zm8A-9OwkoSxiZ_N_PfD5Q=&ratebypass=yes

These are the URLs that will be used to download the video and are tied to your IP (device). Using these URLs to attempt to download the video will sometimes return 403s if you have gotten this URL from a separate device.

@chinecc
Copy link

chinecc commented Jun 18, 2019

I have the same issue. In localhost, I can run the video url, when I tried in my server , it does not work.

@LevitatingBusinessMan
Copy link
Contributor

I got it all fixed by simply updating the package

@chinecc
Copy link

chinecc commented Jun 23, 2019

@kartik1225 sorry, I should have specified, I tested on my remote server using my discord bot. The URL issue mentioned previously is with reference to the download URL which is separate to the link you provided I believe.

For example, if I run;

$ youtube-dl -g https://www.youtube.com/watch?v=PT2_F-1esPk

I will get these download URLs;

https://r1---sn-3xtjvh-ac5e.googlevideo.com/videoplayback?expire=1560912108&ei=i0wJXaHANsSnVtX0gogK&ip=109.246.19.50&id=o-AH-_u7BSGz0QUhmF9snvUxn2V7S9RTOD-L62NT5wIwKm&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397%2C398&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-3xtjvh-ac5e%2Csn-aigzrn7z&ms=au%2Crdu&mv=m&pl=20&gcr=gb&initcwndbps=1361250&mime=video%2Fmp4&gir=yes&clen=104491761&dur=261.803&lmt=1556983934018483&mt=1560890410&fvip=1&keepalive=yes&c=WEB&txp=5535432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cgcr%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cpl%2Cinitcwndbps&lsig=AHylml4wRAIgSKOViPZ6VZCC24LBGv84XETl1SqkiAMcs3Jt7ad9StkCIE1fnTCtHWA4LGKPho198JTBytIBMVsNQMleysD9uXNs&sig=ALgxI2wwRAIgWoMyIOPaoZZTeFlaTBJtcuaBUhMOwNg3kcct3N7TzEACIEabXEUKII7ktCAgYCCLaYDOJ_pPkY7IWvFdofZU_1ab&ratebypass=yes
https://r1---sn-3xtjvh-ac5e.googlevideo.com/videoplayback?expire=1560912108&ei=i0wJXaHANsSnVtX0gogK&ip=109.246.19.50&id=o-AH-_u7BSGz0QUhmF9snvUxn2V7S9RTOD-L62NT5wIwKm&itag=251&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-3xtjvh-ac5e%2Csn-aigzrn7z&ms=au%2Crdu&mv=m&pl=20&gcr=gb&initcwndbps=1361250&mime=audio%2Fwebm&gir=yes&clen=4348334&dur=261.821&lmt=1540261587251261&mt=1560890410&fvip=1&keepalive=yes&c=WEB&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cpl%2Cinitcwndbps&lsig=AHylml4wRAIgSKOViPZ6VZCC24LBGv84XETl1SqkiAMcs3Jt7ad9StkCIE1fnTCtHWA4LGKPho198JTBytIBMVsNQMleysD9uXNs&sig=ALgxI2wwRgIhAPrFih6EoNMrLLcBxoU5h6pxp1eIelLGHus71RIVm6INAiEAzECJLuwwKQuMH_QKCFZX-zm8A-9OwkoSxiZ_N_PfD5Q=&ratebypass=yes

These are the URLs that will be used to download the video and are tied to your IP (device). Using these URLs to attempt to download the video will sometimes return 403s if you have gotten this URL from a separate device.

hi, do you have any solution for fix this issues?

@biwanti
Copy link

biwanti commented Jul 6, 2019

Thank you very much, @tsrubar, your hint helped me a lot. Now it is fixed for me, but I had some troubles to apply properly since I never used npm nor commandline in volumio.
It has to be mentioned that npm must be run within the directory of the package.json, both times. Otherwise I got some warnings and the new version didn#t install properly.

At my job, we ran npm i fent/node-ytdl-core as user volumio, so we got ytdl-core@0.29.2. Then as root edited /data/plugins/music_service/youtube/package.json line 18 to same version "ytdl-core": "^0.29.2", then removed whole node_modules folder, then npm install. After reboot it was working nicely again

@fent fent added the stale Issues that were closed for inactivity label Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues that were closed for inactivity
Projects
None yet
Development

No branches or pull requests