【问题标题】:Is there a way to reload web pages with increasing numerical values?有没有办法重新加载数值增加的网页?
【发布时间】:2020-05-27 18:12:10
【问题描述】:

我想重新加载一个数值增加的 url,所以: www.example.com/page/1/ 变成 www.example.com/page/2/然后www.example.com/page/3/ 等等。

【问题讨论】:

  • 你想用 Javascript 做这个吗?
  • 是的,如果可能的话
  • 听起来你正在尝试做一些基本的网络抓取,是真的吗?

标签: reload


【解决方案1】:

使用 Python

需要安装请求

pip install requests

get_ulrs.py:

import requests

url = 'http://www.example.com/page'


for i in range(10):
    r = requests.get(
        f'{url}/{i}',
    )
   print(r.text)

运行文件

python3 ./get_ulrs.py

【讨论】:

  • @KellyM 如果它对你有用,请务必接受答案:)
猜你喜欢
  • 2021-12-25
  • 2011-06-26
  • 1970-01-01
  • 2018-07-31
  • 2020-07-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-25
相关资源
最近更新 更多