当前位置:网站首页>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'))
边栏推荐
- 毫米波雷达人体感应器,智能感知静止存在,人体存在检测应用
- 开源 SPL 消灭数以万计的数据库中间表
- CF: B. almost Ternary Matrix [symétrie + règles de recherche + Construction + I am Construction Waste]
- Go语言 | 02 for循环及常用函数的使用
- #夏日挑战赛#数据库学霸笔记,考试/面试快速复习~
- Realizing deep learning framework from zero -- LSTM from theory to practice [practice]
- R language Visual scatter plot graph, add labels to some data points in the graph, and always display all labels, even if they have too much overlap. Ggrep package helps
- 全网最全的低代码/无代码平台盘点:简道云、伙伴云、明道云、轻流、速融云、集简云、Treelab、钉钉·宜搭、腾讯云·微搭、智能云·爱速搭、百数云
- PHP利用ueditor实现上传图片添加水印
- [Collection - industry solutions] how to build a high-performance data acceleration and data editing platform
猜你喜欢
Android面试,android音视频开发
Fuzor 2020软件安装包下载及安装教程
关于 Notion-Like 工具的反思和畅想
What are the reliable domestic low code development platforms?
Debezium系列之:记录mariadb数据库删除多张临时表debezium解析到的消息以及解决方法
Reflection and imagination on the notation like tool
测试的核心价值到底是什么?
Ten years at sea: old and new relay, dark horse rising
Technology sharing | interface testing value and system
Django使用mysqlclient服务连接并写入数据库的操作过程
随机推荐
Android interview, Android audio and video development
Summer Challenge database Xueba notes, quick review of exams / interviews~
Hiengine: comparable to the local cloud native memory database engine
2022最新大厂Android面试真题解析,Android开发必会技术
出海十年:新旧接力,黑马崛起
Vagrant2.2.6 supports virtualbox6.1
Fuzor 2020軟件安裝包下載及安裝教程
Oracle Chinese sorting Oracle Chinese field sorting
如何实现游戏中的在线计时器和离线计时器
【C语言】字符串函数及模拟实现strlen&&strcpy&&strcat&&strcmp
R语言使用lubridate包处理日期和时间数据实战
司空见惯 - 英雄扫雷鼠
#夏日挑战赛#数据库学霸笔记,考试/面试快速复习~
Is it safe for Guohai Securities to open an account online?
Common interview questions in Android, 2022 golden nine silver ten Android factory interview questions hit
测试外包公司怎么样?
R language uses lubridate package to process date and time data
Applet modification style (placeholder, checkbox style)
What are the reliable domestic low code development platforms?
Go语言 | 01 WSL+VSCode环境搭建避坑指南