当前位置:网站首页>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'))边栏推荐
- 太牛了,看这篇足矣了
- Mysql如何对json数据进行查询及修改
- JS解力扣每日一题(十二)——556. 下一个更大元素 III(2022-7-3)
- 公司破产后,黑石们来了
- R语言使用lubridate包处理日期和时间数据实战
- 5年经验Android程序员面试27天,2022程序员进阶宝典
- PHP uses ueditor to upload pictures and add watermarks
- CF: B. almost Ternary Matrix [symétrie + règles de recherche + Construction + I am Construction Waste]
- 国内低代码开发平台靠谱的都有哪些?
- uniapp获取微信头像和昵称
猜你喜欢

14、用户、组和权限(14)

Summer Challenge database Xueba notes, quick review of exams / interviews~
PHP利用ueditor实现上传图片添加水印
PHP uses ueditor to upload pictures and add watermarks

MMO project learning 1: preheating

在线协作产品哪家强?微软 Loop 、Notion、FlowUs

Apprentissage du projet MMO I: préchauffage

块编辑器如何选择?印象笔记 Verse、Notion、FlowUs

5 years of experience, 27 days of Android programmer interview, 2022 programmer advanced classic
The problem of returning the longtext field in MySQL and its solution
随机推荐
5年经验Android程序员面试27天,2022程序员进阶宝典
XaaS 陷阱:万物皆服务(可能)并不是IT真正需要的东西
After the company went bankrupt, the blackstones came
JAD的安装、配置及集成IDEA
Mysql如何对json数据进行查询及修改
Go语言 | 03 数组、指针、切片用法
PG基础篇--逻辑结构管理(用户及权限管理)
MySql中的longtext字段的返回问题及解决
Ten years at sea: old and new relay, dark horse rising
关于 Notion-Like 工具的反思和畅想
【C语言】字符串函数及模拟实现strlen&&strcpy&&strcat&&strcmp
Tutoriel de téléchargement et d'installation du progiciel fuzor 2020
HAC cluster modifying administrator user password
Common interview questions in Android, 2022 golden nine silver ten Android factory interview questions hit
2022 the most complete Tencent background automation testing and continuous deployment practice in the whole network [10000 words]
Django使用mysqlclient服务连接并写入数据库的操作过程
Startup and shutdown of CDB instances
Blue sky drawing bed Apple quick instructions
Decision tree and random forest
公司破产后,黑石们来了