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

Basic authentication support for SOCKS proxy #14637

Open
TheDcoder opened this issue Oct 31, 2017 · 10 comments
Open

Basic authentication support for SOCKS proxy #14637

TheDcoder opened this issue Oct 31, 2017 · 10 comments
Labels

Comments

@TheDcoder
Copy link

@TheDcoder TheDcoder commented Oct 31, 2017

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.10.29. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2017.10.29

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Description of your issue, suggested solution and other information

I would like to see support for basic SOCKS5 username and password authentication because not all proxies accept unauthenticated connections 😄

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 31, 2017

It's supported since long time ago. It doesn't work for you?

@yan12125 yan12125 added the question label Oct 31, 2017
@TheDcoder
Copy link
Author

@TheDcoder TheDcoder commented Oct 31, 2017

Well, I don't see any options/parameters which accept credentials for proxies, I have searched for it a couple of times in README 😕

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 31, 2017

How about this?

--proxy socks5://username:password@hostname:port/

Adding some notes in README is indeed necessary 👍

@TheDcoder
Copy link
Author

@TheDcoder TheDcoder commented Oct 31, 2017

I didn't know about the syntax!

C:\Users\TheDcoder>youtube-dl socks5://username:password@hostname:port --simulate https://www.youtube.com/watch?v=jNQXAC9IVRw
[youtube] jNQXAC9IVRw: Downloading webpage
[youtube] jNQXAC9IVRw: Downloading video info webpage
[youtube] jNQXAC9IVRw: Extracting video information
[youtube] jNQXAC9IVRw: Downloading MPD manifest

So I guess it works 😁.

Adding some notes in README is indeed necessary 👍

I agree, there should be notes about the syntax in the README.

@tobijjah
Copy link

@tobijjah tobijjah commented Oct 31, 2017

It is already mentioned in the repo readme.md but not in the docstring if you call youtube-dl --help.

--proxy URL                      Use the specified HTTP/HTTPS/SOCKS proxy.
                                 To enable experimental SOCKS proxy, specify
                                 a proper scheme. For example
                                 socks5://127.0.0.1:1080/. Pass in an empty
                                 string (--proxy "") for direct connection
@TheDcoder
Copy link
Author

@TheDcoder TheDcoder commented Oct 31, 2017

@tobijjah doesn't demonstrate the authentication syntax

@tobijjah
Copy link

@tobijjah tobijjah commented Oct 31, 2017

Modification proposal...

--proxy URL                      Use the specified HTTP/HTTPS/SOCKS proxy.
                                 To enable experimental SOCKS proxy, specify
                                 a proper scheme. For example
                                 socks5://hostname:port/ or 
                                 socks5://username:password@hostname:port/ 
                                 for username and password authentication. 
                                 Pass in an empty string (--proxy "") for 
                                 direct connection.
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 31, 2017

Thanks for pull requests :)

Now we need another documentation improvement - modifications in option descriptions should go to options.py. Relevant sections in README.md are re-generated from options.py in each release.

I haven't check whether such a syntax works for HTTP proxies or not. If so the additional sentence should go before "To enable experimental SOCKS proxy..."

@tobijjah
Copy link

@tobijjah tobijjah commented Oct 31, 2017

I checked it for http and it works as it should. The first #14639 pull request modifies options.py. We just have to append your proposal to this pull request. Oh, the README.md is auto generated, this means I can close the second pull request.
Proposal

--proxy URL                      Use the specified HTTP/HTTPS/SOCKS proxy.
                                 To enable HTTP/HTTPS or experimental SOCKS
                                 proxy, specify a proper scheme. For example
                                 protocol://hostname:port/ or
                                 protocol://username:password@hostname:port/ 
                                 for username and password authentication.
                                 The protocol attribute can be exchanged
                                 with a string like http, https or socks5.
                                 Pass in an empty string (--proxy "") for 
                                 direct connection.

Check for http

youtube-dl -v --test  --proxy http://foo:bar@foo:bar/ https://www.youtube.com/watch?v=zDb7dAnm79I
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--test', '--proxy', 'http://foo:bar@foo:bar/', 'https://www.youtube.com/watch?v=zDb7dAnm79I']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.10.29
[debug] Python version 3.5.2 - Linux-4.10.0-37-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: avconv 2.8.11-0ubuntu0.16.04.1, avprobe 2.8.11-0ubuntu0.16.04.1, ffmpeg 2.8.11-0ubuntu0.16.04.1, ffprobe 2.8.11-0ubuntu0.16.04.1
[debug] Proxy map: {'https': 'http://foo:bar@foo:bar/', 'http': 'http://foo:bar@foo:bar/'}
[youtube] zDb7dAnm79I: Downloading webpage
[youtube] zDb7dAnm79I: Downloading video info webpage
[youtube] zDb7dAnm79I: Extracting video information
[youtube] zDb7dAnm79I: Downloading MPD manifest
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] CocoRosie - Fairy Paradise (Live on KEXP)-zDb7dAnm79I.mkv has already been downloaded and merged
@metin02oktay
Copy link

@metin02oktay metin02oktay commented Jul 27, 2020

If username contain "@", how can ı do that? My school proxy's username is email address that is contain "@"

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
4 participants
You can’t perform that action at this time.