无法从div部分提取数据

问题描述 投票:0回答:1

我想从后面的url中提取主机名和Ip,但它什么都不返回。

import requests
from bs4 import BeautifulSoup

url = "https://mxtoolbox.com/SuperTool.aspx?action=mx%3abuildersinmysore.com&run=toolpage"

response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')

divs = soup.find_all('div', {'class':'tool-result-body'})
#table = soup.find_all('table', {'class': 'table table-striped table-bordered table-condensed tool-result-table'})
print(divs)
python web-scraping
1个回答
0
投票

试试这个

from selenium import webdriver
from time import sleep 

obj = webdriver.Chrome(#path to chrome driver)
obj.get('https://mxtoolbox.com/SuperTool.aspx?action=mx%3abuildersinmysore.com&run=toolpage')
sleep(5)     
#IP Address
print(obj.find_element_by_class_name('table-column-IP_Address').text)
#Hostname
print(obj.find_element_by_class_name('table-column-Hostname').text)
© www.soinside.com 2019 - 2024. All rights reserved.