我需要帮助获得每个页面的链接
我正在尝试从
url = 'https://apexranked.com/'
page = 1
while page != 121:
url = f'https://apexranked.com/?page={page}'
print(url)
page = page + 1
,但是,如果您单击页码,则不包括a https://apexranked.com /?pag = number 如您从 https://www.mlb.com/stats/?page=2 。如果页面不包含?page =链接之后,我将如何从所有页面访问和获取链接?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
单击第2页时,该页面没有重新加载。相反,它向网站的后端发出了 get 请求。
该请求将发送至: https://apexranked.com/wp-admin/admin/admin/admin/admin/admin/admin/admin/admin/admin -ajax.php
另外,将几个参数直接解析到先前的URL上。
?action = get_player_data& pag = 3& total_pages = 195& _ = 1657230896643
参数 :
time.time()
非常轻松地获得UNIX TIMESTAMP否则, 在请求标题中登录以获取JSON,但这只是一个细节。
所有这些信息都结束了:
The page is not reloading when you click on page 2. Instead, it is firing a GET request to the website's backend.
The request is being sent to : https://apexranked.com/wp-admin/admin-ajax.php
In addition, several parameters are parsed directly onto the previous url.
?action=get_player_data&page=3&total_pages=195&_=1657230896643
Parameters :
time.time()
Once you get a response, it yields a rendered HTML, maybe try to set
Accept: application/json
field in request headers to get a Json, but that's just a detail.All these informations wrapped up:
我不确定您的
意思
I don't exactly know what you mean but if you for example wanna get the raw text u can do it with requests
you can also add the link then to an array with
nameOfArray.append(link)