当前位置:网站首页>Reptile exercises (II)
Reptile exercises (II)
2022-07-05 19:22:00 【InfoQ】
"""
The target site :https://www.1ppt.com/moban/
Climbing requirements :
1、 Turn the page and crawl the source code on this page
2、 And save it locally , Pay attention to coding
"""
'''
1. Analysis website :
https://www.1ppt.com/moban/ first page
https://www.1ppt.com/moban/ppt_moban_2.html The second page
https://www.1ppt.com/moban/ppt_moban_3.html The third page
'''
import urllib.request
start = int(input(" Enter the start page ")) # turn int
end = int(input(" Enter the end page "))
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36'
}
for n in range(start, end + 1):
url = 'https://www.1ppt.com/moban/ppt_moban_{}.html'.format(n)
print(url)
req = urllib.request.Request(url, headers=headers) # Instantiate the request object
response = urllib.request.urlopen(req) # The method to send the request
with open(f' The first {n} page .html', 'a', encoding='gb2312') as f:
f.write(response.read().decode('gb2312'))
边栏推荐
- cf:B. Almost Ternary Matrix【對稱 + 找規律 + 構造 + 我是構造垃圾】
- Django使用mysqlclient服务连接并写入数据库的操作过程
- Django uses mysqlclient service to connect and write to the database
- 软件测试是干什么的?学习有啥要求?
- 2022 the latest big company Android interview real problem analysis, Android development will be able to technology
- Is it safe for Guohai Securities to open an account online?
- How to convert word into PDF? Word to PDF simple way to share!
- JMeter 常用的几种断言方法,你会了吗?
- 14、用户、组和权限(14)
- Technology sharing | common interface protocol analysis
猜你喜欢
Cf:b. almost Terry matrix [symmetry + finding rules + structure + I am structural garbage]
出海十年:新旧接力,黑马崛起
测试外包公司怎么样?
Windows Oracle open remote connection Windows Server Oracle open remote connection
2022 the most complete Tencent background automation testing and continuous deployment practice in the whole network [10000 words]
数学分析_笔记_第9章:曲线积分与曲面积分
MMO項目學習一:預熱
word如何转换成pdf?word转pdf简单的方法分享!
acm入门day1
HiEngine:可媲美本地的云原生内存数据库引擎
随机推荐
PHP uses ueditor to upload pictures and add watermarks
JMeter 常用的几种断言方法,你会了吗?
Fundamentals of machine learning (III) -- KNN / naive Bayes / cross validation / grid search
#夏日挑战赛#数据库学霸笔记,考试/面试快速复习~
The binary string mode is displayed after the value with the field type of longtext in MySQL is exported
集合
Oracle fault handling: ora-10873:file * needs to be either taken out of backup or media recovered
大厂面试必备技能,2022Android不死我不倒
UDF implementation of Dameng database
How MySQL queries and modifies JSON data
Talking about fake demand from takeout order
出海十年:新旧接力,黑马崛起
Go语言 | 01 WSL+VSCode环境搭建避坑指南
强化学习-学习笔记4 | Actor-Critic
Oracle Chinese sorting Oracle Chinese field sorting
【AI 框架基础技术】自动求导机制 (Autograd)
软件测试工程师是做什么的?待遇前景怎么样?
潘多拉 IOT 开发板学习(HAL 库)—— 实验8 定时器中断实验(学习笔记)
打新债在哪里操作开户是更安全可靠的呢
Hiengine: comparable to the local cloud native memory database engine