1 Star 0 Fork 0

20192412公凯文 / pythonProject01

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
sy4.py 720 Bytes
一键复制 编辑 原始数据 按行查看 历史
20192412公凯文 提交于 2021-06-27 23:10 . py4
# 导入库
import requests
from bs4 import BeautifulSoup
i = 7109
while True:
# 写上链接
url = f'https://www.xbiquge.la/0/10/{str(i)}.html'
# 设置请求头
headers = { # 告诉对方服务器,我们的身份
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
}
# 发送请求
html = requests.get(url,headers=headers)
html.encoding = 'UTF-8'
str_html = html.text
head1=str_html.find('<h1>')
head2=str_html.find('</h1>')
if str_html[head1+7:head2]==' Service Temporarily Unavailable':
continue
print(str_html[head1+7:head2])
i+=1
if i>8110:
break
1
https://gitee.com/gkw2412/pythonProject01.git
git@gitee.com:gkw2412/pythonProject01.git
gkw2412
pythonProject01
pythonProject01
master

搜索帮助