I need to get ip address of website, for example, 'https://www.facebook.com/'
This code returns ip address:
ip_address = socket.gethostbyname('www.facebook.com')
print('ip_address = ', ip_address) # prints 185.60.216.35
But this code:
ip_address = socket.gethostbyname('https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110')
throws an exception:
socket.gaierror: [Errno -2] Name or service not known
Is there any way in python to get ip address from this link 'https://www.facebook.com/' without retrieving www.facebook.com ?