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

Add support for SOCKS proxy (e.g. Tor)? #3093

Closed
felixphew opened this issue Jun 17, 2014 · 6 comments
Closed

Add support for SOCKS proxy (e.g. Tor)? #3093

felixphew opened this issue Jun 17, 2014 · 6 comments

Comments

@felixphew
Copy link

@felixphew felixphew commented Jun 17, 2014

I would like to use youtube-dl behind a transparent proxy at school. However, it can be restrictive and, worse still, it's not completely "transparent". So when I download a youtube video, it keeps returning a 7kb file that I assume is a redirection page. The same is true for most sites. With other programs I can sometimes circumvent this using TOR, but I am unable to do this with youtube-dl as it does not support SOCKS proxies. It also doesn't react well to wrappers (e.g. usewithtor, torsocks, torify, proxy chains etc.). Please add SOCKS support soon!

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jun 17, 2014

I'm not a tor expert, but it seems that using torify youtube-dl ... works:

$ youtube-dl 'https://check.torproject.org/' --write-pages
[debug] System config: []
[debug] User config: ['--keep-video', '--write-info-json', '--write-thumbnail', '--verbose']
[debug] Command-line args: ['https://check.torproject.org/', '--write-pages']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2014.06.16
[debug] Git HEAD: b60a469
[debug] Python version 3.4.1 - Darwin-13.2.0-x86_64-i386-64bit
[debug] Proxy map: {}
[generic] check.torproject: Requesting header
WARNING: Falling back on generic information extractor.
[generic] check.torproject: Downloading webpage
[generic] Saving request to check.torproject_https_-_check.torproject.org_.dump
[generic] check.torproject: Extracting information
ERROR: Unsupported URL: https://check.torproject.org/; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
<ERROR DETAILS>

$ grep 'Tor' check.torproject_https_-_check.torproject.org_.dump
  <title>Are you using Tor?</title>
      Sorry. You are not using Tor.
      If you are attempting to use a Tor client, please refer to the <a href="https://www.torproject.org/">Tor website</a> and specifically the <a href="https://www.torproject.org/docs/faq#DoesntWork">instructions for configuring your Tor client</a>.
  <a id="donate" href="https://www.torproject.org/donate/donate.html">Donate to Support Tor</a>
      <a href="https://tor.stackexchange.com/">Tor Q&amp;A Site</a>
    <p class="project">The Tor Project is a US 501(c)(3) non-profit dedicated to the research, development, and education of online anonymity and privacy. <a href="https://www.torproject.org/about/overview.html.en">Learn More &raquo;</a></p>

$ torify youtube-dl 'https://check.torproject.org/' --write-pages
.... SAME AS BEFORE

$ grep 'Tor' check.torproject_https_-_check.torproject.org_.dump
  <title>Are you using Tor?</title>
      Congratulations. This browser is configured to use Tor.
            However, it does not appear to be the Tor Browser Bundle.<br />
      Please refer to the <a href="https://www.torproject.org/">Tor website</a> for further information about using Tor safely.  You are now free to browse the Internet anonymously. For more information about this exit relay, see: <a href="https://atlas.torproject.org/#details/<REMOVED>">Atlas</a>.
  <a id="donate" href="https://www.torproject.org/donate/donate.html">Donate to Support Tor</a>
      <a href="https://tor.stackexchange.com/">Tor Q&amp;A Site</a>
    <p class="project">The Tor Project is a US 501(c)(3) non-profit dedicated to the research, development, and education of online anonymity and privacy. <a href="https://www.torproject.org/about/overview.html.en">Learn More &raquo;</a></p>

Why do you say it doesn't work in your case?

There's already an issue about implementing SOCKS proxy support: #402.

@felixphew
Copy link
Author

@felixphew felixphew commented Jun 17, 2014

I'm on OS X and so I compiled tor and torsocks (which is the backend to torify) myself, but I didn't do such a great job, and so my torify/torsocks/usewithtor only work about half the time. I know this is a problem at my end, not yours, but SOCKS support would be great anyway.

@vedharish
Copy link

@vedharish vedharish commented Jun 18, 2014

Works with proxychains as well.
Just chain it to the tor proxy.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jun 18, 2014

You can use a package manager (like Hombrew) to install tor.
I'm closing this issue in favour of the old one.

@jaimeMF jaimeMF closed this Jun 18, 2014
@ghost ghost mentioned this issue Jun 21, 2014
@moshpirit
Copy link

@moshpirit moshpirit commented Aug 16, 2015

┌─ alberto manjaro  ~ 
└──┤|▶ torify youtube-dl 'https://check.torproject.org/' --write-pages
[generic] check.torproject: Requesting header
[Aug 16 18:37:21] PERROR torsocks[3160]: socks5 libc connect: Connection refused (in socks5_connect() at socks5.c:185)
WARNING: Could not send HEAD request to https://check.torproject.org/: <urlopen error [Errno -4] Non-recoverable failure in name resolution>
[generic] check.torproject: Downloading webpage
[Aug 16 18:37:21] PERROR torsocks[3160]: socks5 libc connect: Connection refused (in socks5_connect() at socks5.c:185)
ERROR: Unable to download webpage: <urlopen error [Errno -4] Non-recoverable failure in name resolution> (caused by URLError(gaierror(-4, 'Non-recoverable failure in name resolution'),))

Am I doing anything wrong? it could be really cool to add youtube-dl -tor as another option

@yxliang01
Copy link

@yxliang01 yxliang01 commented Apr 15, 2017

when connecting to google services, won't tor connections need a captcha?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.