如何从XHR获取此URL

2024-03-29 12:06:01 发布

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

我想通过请求从这个Page获取这个URL

我要获取的URL:https://www.holonis.com/api/comments/5ae3cfc82eebca0025b9890c/post


Tags: httpscomapiurlwwwpagepostcomments
1条回答
网友
1楼 · 发布于 2024-03-29 12:06:01

您可以通过请求获取请求。获取:

import json
import requests

## Fetch the page
resp = requests.get(url)

## Load it into a dict
node = json.loads(resp.text)

然后,您可以从节点获取注释或其他信息,如下所示:

comments = [element['body'] for element in node['items']]

相关问题 更多 >