Open abdwap opened 1 month ago
Having the same issue even with a single request from a new ip (aws sagemaker instance).
YouTube is working to prevent ad blockers and third-party apps, see #170.
The problem can be solved by adding use_oauth=true or proxies=my_proxies
I am logging the frequency my system is detected as BOT using the implementation of @felipeucelli at https://github.com/JuanBindez/pytubefix/pull/170
It is a concerning problem.
For now I am managing by using proxies. If is detected as BOT, then change IP with a different proxy and retry.
Hi @NannoSilver, from my tests, most of the problems are related to cloud services, perhaps YouTube has implemented a list of IPs from well-known companies or it may also be monitoring the number of requests.
Maybe the PoToken request can get around this.
The yt-dlp is trying to solve this, but it has not yet been possible to generate the PoToken without using a browser or a VM.
I had a same problem, but only if I try the code from my pythonanywhere bash, the same code work ok from my own laptop
How to use a proxy and add fields to the certificate?
like this response = requests.get( "https://httpbin.org/get", proxies={ "http": "http://localhost:@proxy:8011/", "https": "http://localhost:@proxy:8011/", }, verify='/path/to/proxy-ca.crt )
If you don't find an answer soon, you could use selenium for searching.
@abdwap
The problem can be solved by adding use_oauth=true or proxies=my_proxies
Any way to access the cache? If running in serverless environment, the identity will always change so oauth is less useful. Looking for a way to save cached oauth to a shared filesystem.
@abdwap
The problem can be solved by adding use_oauth=true or proxies=my_proxies
what is my_proxies?
Proxies can be used like this:
proxy = '111.11.111.11:1234' #put proxy IP here
proxies = {
"http": f"http://{proxy}/",
"https": f"https://{proxy}/",
}
yt = YouTube(video_link, proxies=proxies)
I have yet to find usable proxies though so if someone finds some i would welcome a solution
uEeCl1KyXiI This request has been detected as a bot, please try again or log in to view
from pytubefix import Search results = Search("new") for video in results.videos: print(f'Title: {video.title}') print(f'URL: {video.watch_url}') print(f'Duration: {video.length} seg') print('---')