当前位置:网站首页>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'))
边栏推荐
- Pandora IOT development board learning (HAL Library) - Experiment 8 timer interrupt experiment (learning notes)
- cf:B. Almost Ternary Matrix【對稱 + 找規律 + 構造 + 我是構造垃圾】
- Go语言学习教程(十五)
- cf:B. Almost Ternary Matrix【对称 + 找规律 + 构造 + 我是构造垃圾】
- 【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
- PG基础篇--逻辑结构管理(用户及权限管理)
- Is it safe for Guohai Securities to open an account online?
- Django使用mysqlclient服务连接并写入数据库的操作过程
- flume系列之:拦截器过滤数据
- 华为让出的高端市场,小米12S靠徕卡能抢到吗?
猜你喜欢
XaaS 陷阱:万物皆服务(可能)并不是IT真正需要的东西
MMO項目學習一:預熱
UWB超宽带定位技术,实时厘米级高精度定位应用,超宽带传输技术
After the company went bankrupt, the blackstones came
不愧是大佬,字节大牛耗时八个月又一力作
The relationship between temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
cf:B. Almost Ternary Matrix【对称 + 找规律 + 构造 + 我是构造垃圾】
How to choose the notion productivity tools? Comparison and evaluation of notion, flowus and WOLAI
如何实现游戏中的在线计时器和离线计时器
UDF implementation of Dameng database
随机推荐
XaaS 陷阱:万物皆服务(可能)并不是IT真正需要的东西
Android面试,android音视频开发
Technology sharing | common interface protocol analysis
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
#夏日挑战赛# HarmonyOS - 实现消息通知功能
Startup and shutdown of CDB instances
PG basics -- Logical Structure Management (user and permission management)
【C语言】字符串函数及模拟实现strlen&&strcpy&&strcat&&strcmp
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
acm入门day1
[today in history] July 5: the mother of Google was born; Two Turing Award pioneers born on the same day
Blue sky drawing bed Apple quick instructions
Shell编程基础(第8篇:分支语句-case in)
完爆面试官,一线互联网企业高级Android工程师面试题大全
Realizing deep learning framework from zero -- LSTM from theory to practice [practice]
ELK分布式日志分析系统部署(华为云)
5 years of experience, 27 days of Android programmer interview, 2022 programmer advanced classic
S7-200SMART利用V90 MODBUS通信控制库控制V90伺服的具体方法和步骤
国内低代码开发平台靠谱的都有哪些?
Fundamentals of shell programming (Part 8: branch statements -case in)