The first link was just a Selenium script for access to YouTube:
from selenium import webdriver
PATH = r"C:\Users\hp\Desktop\prog\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("https://youtube.com")
This Python program works perfectly fine, but when I try the same thing with a Cloudflare-protected website, it gets stuck in the wait page. I did some research and found an undetected Chrome driver to use, but I keep getting errors like "RuntimeError".
The libraries are all perfectly installed. I did more research and found a YouTube video that I could follow, but I’m still getting errors. Here is the second code:
import selenium
import undetected_chromedriver.v2 as uc
import time
options = uc.ChromeOptions()
py = "24.172.82.94:53281"
options.add_argument('--proxy-server=%s' % py)
driver = uc.Chrome(options=options)
driver.get("https://ifconfig.me/")
time.sleep(4)
The error I get:
AttributeError: 'ChromeOptions' object has no attribute 'add'