[Python] How to check if link still the same?

Discussão em 'Python' iniciado por Stack, Maio 26, 2025.

  1. Stack

    Stack Membro Participativo

    I want to check if this link still valid or nothttps://www.udemy.com/course/artificial-intelligence-in-digital-marketing/?couponCode=DIGITALMARKETING, as once this coupon expires it would turn me to the original course page https://www.udemy.com/course/artificial-intelligence-in-digital-marketing/, I have used selenium to do this, but it's kinda slow and Udemy block me after two pages.

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    import time
    i= "https://www.udemy.com/course/artificial-intelligence-in-digital-marketing/?couponCode=DIGITALMARKETING"
    driver = webdriver.Chrome()
    driver.get(i)
    time.sleep(1)
    currentUrl= driver.current_url
    if i== currentUrl:
    print("true")


    Does anyone have an idea for a fester way to do that? I have tried using urllib3 and requests, but neither of them worked. I tried to parse it with Beautiful Soup also hoping to find something in the code but I couldn't find any because the web site is dynamic.

    Continue reading...

Compartilhe esta Página