从 URL 中抓取字段并构建排名表

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

这是我从网站上抓取数据的第一个项目,所以请指导我,因为我听起来肯定像个新手。所以这就是我想要做的:废弃 URL 上的字段 Church Size。这里的标识符是数字5611。我想建立一个表,它将根据教会规模(第一行应为最高数字,最后一行应为最低数字)从标识符 5550 到 5615 对帖子进行排名。任何人都可以提供我可以玩的基本代码片段吗我。非常感谢。

网址:https://oppsearch.ucc.org/web/fastdetails.aspx?id=5611&KeepThis=false&TB_iframe=true&height=&width=

编辑1:

import requests
from bs4 import BeautifulSoup
URL = "https://oppsearch.ucc.org/web/fastdetails.aspx?id=4784&KeepThis=false&TB_iframe=true&height=798&width=960"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
results = soup.find(id="ContentPlaceHolder1_city")
print(results.prettify())

结果为:

jatinkashyap@Jatins-Air UCC % python3 trial.py
<span id="ContentPlaceHolder1_city">
 Lowden
</span>
python web-crawler
© www.soinside.com 2019 - 2024. All rights reserved.