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

Download Video with Proxy Oxylabs Got Error: This request was detected as a bot (already use PO Token) #418

Open
dmitrimahayana opened this issue Jan 19, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@dmitrimahayana
Copy link

🐞 Bug Description

Earlier, I created a bugfix ticket #417.
However, I still can't use the proxy with po_token.
I passed parameters like client, use_po_token, po_token_verifier, and proxies,
I am using Oxylabs with ISP proxy.


🔢 Code Snippet

Include the minimal code snippet that reproduces the issue.

proxy_user = "proxy_user:proxy_pass"
proxy_isp = "isp.oxylabs.io:8010"
proxies = {
	"http": f"http://{proxy_user}@{proxy_isp}",
	"https": f"https://{proxy_user}@{proxy_isp}"
}
media_url = "https://www.youtube.com/watch?v=eIdC5zESkBw"

visitorData = "Cgs5NjVVdWRqUi1NTSi44dq7BjIKCgJJRBIEGgAgaA%3D%3D"
poToken = "MnQLzlywy_HFbwv2p4LfsTj0ArWVcJ3UwbzDQbBP89M2bsuZRbULgcnV7WMYkXs41ZXBACGNKJF_BHGbW76c-DME1zRcVtRjPcAA2rnXRYFZe3BKKrinbrRY7sGtplmaPXPqFHf-RYjN2ecLriWjdbSTWTwkGQ=="
yt = YT(url=media_url, client="WEB", use_po_token=True, po_token_verifier=(visitorData, poToken), proxies=proxies)
print(f"Initialized object pytubefix with po_token_verifier visitorData:{visitorData} poToken:{poToken} proxy:{proxy_isp}")
yt_stream = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()

🎯 Expected Behavior

Normally, I can get the YouTube video based on the filter inside method yt.streams.filter


📸 Screenshots or Logs

Image


🖥️ Environment Details

Fill in the details below about your setup:

  • Operating System: Windows 11
  • Python Version: 3.9.13
  • Pytubefix Version: 8.12.0

@JuanBindez
Copy link
Owner

It doesn't seem to be working well, if it continues like this I will downgrade, thanks for the details

@NannoSilver
Copy link
Contributor

NannoSilver commented Jan 20, 2025

I am not very familiar on how the poToken works, but in my vision is likely the IP is part of the potoken output. If this is correct then it must be for the proxy IP, rather than the local machine IP.

@NannoSilver
Copy link
Contributor

It doesn't seem to be working well, if it continues like this I will downgrade, thanks for the details

I think poToken should be kept even if there is some issue.
This will allow the issues to be tracked and resolved.
For the near future the poToken will be a must because Youtube is progressively blocking all the proxies, even residential proxies.

@JuanBindez
Copy link
Owner

Hello, yes, but we need to fix some things and it doesn't always need Po and it is showing messages saying that it needs Po, in excess this causes confusion, and I think that some blocks may not be due to Token, but perhaps header, I did some tests without being with pytubefix and I was not blocked even using the same IP, this indicates that it is not exactly an IP block but rather in the request, I will investigate further to understand how this is being done, to try not to depend 100% on PoToken

@dmitrimahayana
Copy link
Author

dmitrimahayana commented Jan 21, 2025

Hi @JuanBindez @NannoSilver ,
Thanks for replying.
When I tried to deploy the pytubefix in AWS Lambda and passing the po_token without proxy, it returned different error:
Error 429: Too Many Requests.
But when I passed the proxy again, it returned This request was detected as bot.

Compared to my local test using my PC, I can use po_token smoothly but it always fails when passing the proxy.

@JuanBindez JuanBindez moved this from waiting to bug in Improving Pytubefix Jan 22, 2025
@felipeucelli
Copy link
Contributor

I am not very familiar on how the poToken works, but in my vision is likely the IP is part of the potoken output. If this is correct then it must be for the proxy IP, rather than the local machine IP.

The poToken receives the visitorData which contains data, for example the country of origin.

The poToken may also have an expiration time of times it can be used.

For some reason, sometimes poToken can work on different IPs than the one generated, but it is not guaranteed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

4 participants