如何使用请求从赌博网站获取数据

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

我想通过此代码获取比赛、球队名称、日期、时间以及每场比赛的链接。我想从这个网站获取数据:

https://www.asianbetsoccer.com/it/nextgame.html

url = "https://www.asianbetsoccer.com/tables/tablenext/cdf8b58456359588508b794fb72d2e16b1e15161.js"

headers = {
    "Referer": "https://www.asianbetsoccer.com/nextgame.html",
    "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0",
}

data = requests.get(url, headers=headers).text
print(data)

我得到这个答案:

var update = "2024-02-05T14:42:15Z"; $("#odds_caption").html("188Bet Odds"); var sf = $("#searchfilter").val();

...

但我只想获取每个“match1text”的文本

python python-requests
1个回答
0
投票

requests
不会费心去解析它得到的响应。如果它是 HTML,您可以使用
bs4
,但由于您有 JavaScript,所以我没有看到比手动解析它更简单的解决方案。正则表达式可能会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.