mercredi 23 juin 2021

Get site url after rediretct requests

I was wondering if I can get the current url that pop ups on the searchbar in our browser, after a redirect from the staring page, done with requests.

For example:

I send the reqeusts to "google.com" that instantanely sends me to "google.com/page-123456", the page number changes everytime. Can I get the "google.com/page-123456" in my script?

With selenium it can be made like this:

import selenium
import time

driver = (...)
driver.get('google.com')
time.sleep(2)
url = driver.current_url

Can be this made in reqeusts / BeautifoulSoup? How? Thanks




Aucun commentaire:

Enregistrer un commentaire