Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Proxy Support #38

Closed
untergrundbiber opened this issue Aug 2, 2014 · 15 comments
Closed

Proxy Support #38

untergrundbiber opened this issue Aug 2, 2014 · 15 comments

Comments

@untergrundbiber
Copy link

Hi there

I work on a script to download YT videos, that are blocked in my country, over an ssh-tunnled proxy.
I tried your example download script with the option "--proxy=127.0.0.1:8000", but it throws an error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: status code 403
    at Request.<anonymous> (/root/nodejs/node_modules/youtube-dl/lib/youtube-dl.js:65:30)
    at Request.EventEmitter.emit (events.js:95:17)
    at Request.onResponse (/root/nodejs/node_modules/youtube-dl/node_modules/request/request.js:924:10)
    at ClientRequest.g (events.js:180:16)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1688:21)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
    at CleartextStream.socketOnData [as ondata] (http.js:1583:20)
    at CleartextStream.read [as _read] (tls.js:511:12)
    at CleartextStream.Readable.read (_stream_readable.js:320:10)

When i call youtube-dl from the console it works flawless.
"youtube-dl --proxy http://127.0.0.1:8000/ https://www.youtube.com/watch?v=Lle-q-0SL_c"

Would it be possible to implant proxy support?

Greetings

@fent
Copy link
Collaborator

fent commented Aug 2, 2014

Does it work without the proxy?

@untergrundbiber
Copy link
Author

Yes, without proxy i have no problems.

@fent
Copy link
Collaborator

fent commented Aug 2, 2014

Can you try prepending the proxy address with http://. Also can you try separating it into two strings, --proxy and http://127.0.0.1:8000/

@untergrundbiber
Copy link
Author

I would really like to test but with the new version 1.5.9 I also have a new problem.
This error occurs regardless of whether with or without proxy.

/root/ytdl_nodejs/node_modules/youtube-dl/lib/youtube-dl.js:109
      if (!options.nosubs && isNoSubsRegex.test(stderr)) {
                  ^
TypeError: Cannot read property 'nosubs' of undefined
    at /root/ytdl_nodejs/node_modules/youtube-dl/lib/youtube-dl.js:109:19
    at ChildProcess.exithandler (child_process.js:635:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

@fent
Copy link
Collaborator

fent commented Aug 5, 2014

Sorry about that, should be good now.

@untergrundbiber
Copy link
Author

Sorry, next error :(
I only install youtube-dl over npm, without any changes and execute your example-script.

~/ytjs/node_modules/youtube-dl/example # node download.js

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: : video doesn't have subtitles
WARNING: video doesn't have subtitles

    at /root/ytjs/node_modules/youtube-dl/lib/youtube-dl.js:125:23
    at ChildProcess.exithandler (child_process.js:635:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

@fent
Copy link
Collaborator

fent commented Aug 6, 2014

Are you running the exact file in the example dir? I just ran it and it downloaded fine.

@untergrundbiber
Copy link
Author

Yes, install with "npm install youtube-dl" and run it in the example-dir

@fent
Copy link
Collaborator

fent commented Aug 6, 2014

I just did that, same result.

@untergrundbiber
Copy link
Author

Ahh i'm so sorry, i forgot that i have a regular installed youtube-dl with a config (/etc/youtube-dl.conf) that download all subs. Sorry!
I tested it now on another machine with fresh youtube-dl and it works. 👍

And now the tests with proxy:
I used the example download.js and change the the video-variable.

var video = ytdl('http://www.youtube.com/watch?v=Lle-q-0SL_c',['--proxy=http://127.0.0.1:8000/']);

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: status code 403
    at Request.<anonymous> (/home/synctube/ytjs/node_modules/youtube-dl/lib/youtube-dl.js:51:30)
    at Request.EventEmitter.emit (events.js:95:17)
    at Request.onResponse (/home/synctube/ytjs/node_modules/youtube-dl/node_modules/request/request.js:958:10)
    at ClientRequest.g (events.js:180:16)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1688:21)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
    at CleartextStream.socketOnData [as ondata] (http.js:1583:20)
    at CleartextStream.read [as _read] (tls.js:511:12)
    at CleartextStream.Readable.read (_stream_readable.js:320:10)

and without equal sign:
var video = ytdl('http://www.youtube.com/watch?v=Lle-q-0SL_c',['--proxy http://127.0.0.1:8000/']);

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Command failed: Usage: youtube-dl [options] url [url...]

youtube-dl: error: no such option: --proxy http://127.0.0.1:8000/

    at ChildProcess.exithandler (child_process.js:637:15)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

@fent
Copy link
Collaborator

fent commented Aug 6, 2014

Hmm, I'm not sure how I can test this myself. Is there a proxy service somewhere I can use to test?

@untergrundbiber
Copy link
Author

Yes, you can use one of these proxies:
http://proxylist.hidemyass.com/#listable

or you use Tinyproxy and make your own local proxy, i think it makes no difference
https://banu.com/tinyproxy/

@fent
Copy link
Collaborator

fent commented Aug 7, 2014

Ok. I just tried it by separating the option into two strings and it worked. Try this

var video = ytdl('http://www.youtube.com/watch?v=Lle-q-0SL_c',['--proxy', 'http://127.0.0.1:8000/']);

@untergrundbiber
Copy link
Author

Wow, that works! Thank you so much! 👍 👍 👍

@fent
Copy link
Collaborator

fent commented Aug 8, 2014

np.

@fent fent closed this as completed Aug 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants