中国网站
here
主要描述一家公司的信息。由于有许多页面包含类似的内容,我决定学习python中的数据爬虫。
基本代码
import requests
from bs4 import BeautifulSoup
page = requests.get('http://182.148.109.184/enterprise-
info!getCompanyInfo.action?companyid=1000356')
soup = BeautifulSoup(page.text, 'html.parser')
source_content = soup.find(class_='rightSide').find(class_='content register').find(class_='formestyle')
我想收集的信息
这个图是在chrome的inspect元素页面中捕获的。
也许中国人在这里不友好,我在这里创造了一个更好的例证。
<th> the variable name </th> => For example, "company name", "company location"
<td> the target data I want to save </td>
我的问题
根据我的基本代码,
source_content
里面没有任何信息。输出文件如下所示:
对比图1,2,我们可以看到经度,纬度的信息已经消失了。
如何用python获取这些数据?任何建议都将不胜感激