JuanBindez / pytubefix

Python3 library for downloading YouTube Videos.
http://pytubefix.rtfd.io/
MIT License
593 stars 85 forks source link

How to use a private socks5 proxy in pytubefix? #271

Open florestdev opened 1 week ago

florestdev commented 1 week ago

:exclamation: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE :exclamation:

lack of information will lead to closure of the issue


Describe the bug A clear and concise description of what the bug is.


code that was used that resulted in the bug

from pytubefix import YouTube

# put your code here

Expected behavior A clear and concise description of what you expected to happen.


Screenshots If applicable, add screenshots to help explain your problem.


Desktop (please complete the following information):


Additional context Add any other context about the problem here.

JuanBindez commented 1 week ago
from pytubefix import YouTube

proxy = {
    "http": "socks5://proxy_address",
    "https": "socks5://proxy_address"
    }

url = "url"

yt = YouTube(url, proxies=proxy)
print(yt.title)

ys = yt.streams.get_highest_resolution()
ys.download()
florestdev commented 3 days ago
from pytubefix import YouTube

proxy = {
    "http": "socks5://proxy_address",
    "https": "socks5://proxy_address"
    }

url = "url"

yt = YouTube(url, proxies=proxy)
print(yt.title)

ys = yt.streams.get_highest_resolution()
ys.download()

Thanks. But I want to know how use private proxies with username and password. How can I do this?

deeffest commented 1 day ago

with a username and password

{
    "http": "socks5://user:pass@socks5.example.com:1080",
    "https": "socks5://user:pass@socks5.example.com:1080"
}

without

{
    "http": "socks5://socks5.example.com:1080",
    "https": "socks5://socks5.example.com:1080"
}
florestdev commented 1 day ago

with a username and password

{
    "http": "socks5://user:pass@socks5.example.com:1080",
    "https": "socks5://user:pass@socks5.example.com:1080"
}

without

{
    "http": "socks5://socks5.example.com:1080",
    "https": "socks5://socks5.example.com:1080"
}

Sorry, but that's exactly what I did. What should I do if I get the error "The destination computer rejected the connection request"?

deeffest commented 1 day ago

I had the same error when using a free VPN, YouTube itself worked without problems, but I couldn't download anything through pytube. After buying a paid VPN/Proxy everything worked as it should.

florestdev commented 1 day ago

I had the same error when using a free VPN, YouTube itself worked without problems, but I couldn't download anything through pytube. After buying a paid VPN/Proxy everything worked as it should.

My proxy is private. What can I do? (I paid for this)

deeffest commented 1 day ago

Does YouTube itself work through your proxy?

florestdev commented 1 day ago

Does YouTube itself work through your proxy?

Yeah, bro. It works.

deeffest commented 1 day ago

I suggest you try changing socks5 to http(s), in most cases you can do this on the website of the proxy you bought. And I want to make sure, are you using an IPv4 proxy?

florestdev commented 1 day ago

I suggest you try changing socks5 to http(s), in most cases you can do this on the website of the proxy you bought. And I want to make sure, are you using an IPv4 proxy? Okey. I will change a protocol right now. Yes, I use IPv4.