使用Python访问Firefox检查器中的代码

2024-04-28 10:18:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在学习用Python进行刮削。{{cd1>从源代码中提取信息。但是,我发现源代码中并没有报告Firefox Inspector中可用的所有信息。为什么会这样?在


Tags: 信息inspector源代码报告firefoxcd1
1条回答
网友
1楼 · 发布于 2024-04-28 10:18:25

该网站有一个单独的JSON API用于竞标。在

import requests
import json
from bs4 import BeautifulSoup as soup


data = requests.get("http://www.charitystars.com/ajax/getbidshistory?oid=9315")
data_dict = json.loads(data.text)

auction_table = soup(data_dict["html"])

for td in auction_table.find_all("td"):
    print td.get_text()

"""
28/04/2016
 andy.shirt.5

€ 120

27/04/2016
 simone.vanin

€ 60

"""

您可以简单地增加oid来获得所有拍卖。不过,要对网站好点!再加上延迟之类的事情,这样你就不会为慈善事业付出代价了!在

相关问题 更多 >