I am trying to find a method to find the primary domain for a website.
For example: if you visit www.yalochat.com the browser automatically changes the address to www.yalo.com. Therefore:
Input: www.yalochat.com Output: www.yalo.com
Input: www.yalo.com Output: www.yalo.com
Any suggestions?
Thanks!
You can achieve this with the requests module as follows:
import requests
with requests.Session() as s:
r = s.get('https://www.yalochat.com')
r.raise_for_status()
print(r.url)