This is my code what is wrong with it I want to extract this list
Thanks in advance
I tried extracting it more than once, but it failed
CodePudding user response:
Hoping that OP's next question will be more in line with Stackoverflow standards (see how to ask and what a minimal, reproducible example means), here is one way of obtaining that information:
import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
url = 'https://viewdns.info/reverseip/?host=192.64.119.160&t=1'
soup = bs(requests.get(url, headers=headers).text, 'html.parser')
table = soup.select_one('table[border="1"]')
df = pd.read_html(str(table), header=0)[0]
print(df)
df.to_csv('some_websites.csv')
Result in terminal (also saved as csv):
Domain Last Resolved Date
0 0wnyourself.com 2015-11-14
1 16135.co 2016-11-12
2 1800principal.com 2022-10-30
3 1987blakelyroad.com 2015-03-23
4 1trust.in 2022-11-20
... ... ...
995 zebsgrainfreekitchen.com 2015-06-21
996 zenigator.com 2015-09-19
997 zgdw.co 2016-11-12
998 zishee.com 2022-10-30
999 zombietokombi.com.au 2016-03-20
1000 rows × 2 columns