wolfswolke / aniworld_scraper

Aniworld.to mp4 scraper for animes.
MIT License
49 stars 16 forks source link

Not really an issue but i can help you with the redirect. #2

Closed Michtdu closed 1 year ago

Michtdu commented 1 year ago

`from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.support.ui import WebDriverWait from threading import Thread

def open_captcha_window(full_url): options = webdriver.ChromeOptions() options.add_argument("app=" + full_url) options.add_argument("window-size=423,705")

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get(full_url)

wait = WebDriverWait(driver, 100, 0.3)
wait.until(lambda redirect: redirect.current_url != full_url)

new_page = driver.current_url
Thread(target=threaded_driver_close, args=(driver,)).start()
return new_page

def threaded_driver_close(driver): driver.close() `

this code opens a captcha and returns the url you get redirected to. Currently works with the redirects.

wolfswolke commented 1 year ago

@Michtdu Thank you. I will try to implement this today if i have time.

wolfswolke commented 1 year ago

Thank you again. Your Code worked and i only need to fix the slow download now. If you have any other tips or need help feel free to contact me! Thank you!