当前位置:网站首页>爬虫练习题(三)
爬虫练习题(三)
2022-07-06 23:52:00 【InfoQ】
'''
1.分析网页:
https://www.6pian.cn/
https://www.6pian.cn/xq.html
https://www.6pian.cn/xq/1/0.html
https://www.6pian.cn/xq/2/0.html
https://www.6pian.cn/xq/3/0.html
'''
import urllib.request
start = int(input("请输入起始页"))
end = int(input("请输入结束页"))
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44'
}
for n in range(start, end + 1):
url = 'https://www.6pian.cn/xq/{}/0.html'.format(n)
print(url)
q = urllib.request.Request(url,headers=headers)
response = urllib.request.urlopen(q)
with open(f'第{n}页.html','w',encoding='utf-8')as f:
f.write(response.read().decode('utf-8'))
边栏推荐
- English语法_名词 - 所有格
- [reading of the paper] a multi branch hybrid transformer network for channel terminal cell segmentation
- Flink SQL realizes reading and writing redis and dynamically generates hset key
- Sorry, I've learned a lesson
- Tablayout modification of customized tab title does not take effect
- 利用OPNET进行网络指定源组播(SSM)仿真的设计、配置及注意点
- Leetcode: maximum number of "balloons"
- 消息队列:消息积压如何处理?
- Make web content editable
- Use Zhiyun reader to translate statistical genetics books
猜你喜欢
Use, configuration and points for attention of network layer protocol (taking QoS as an example) when using OPNET for network simulation
京东商品详情页API接口、京东商品销量API接口、京东商品列表API接口、京东APP详情API接口、京东详情API接口,京东SKU信息接口
Dj-zbs2 leakage relay
[reading of the paper] a multi branch hybrid transformer network for channel terminal cell segmentation
Leetcode 1189 maximum number of "balloons" [map] the leetcode road of heroding
《5》 Table
Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
基于NCF的多模块协同实例
How digitalization affects workflow automation
High voltage leakage relay bld-20
随机推荐
Unity让摄像机一直跟随在玩家后上方
Jhok-zbl1 leakage relay
消息队列:如何确保消息不会丢失
Summary of the mean value theorem of higher numbers
Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]
JVM (XX) -- performance monitoring and tuning (I) -- Overview
Most commonly used high number formula
Flink SQL realizes reading and writing redis and dynamically generates hset key
4. 对象映射 - Mapping.Mapster
Lombok plug-in
京东商品详情页API接口、京东商品销量API接口、京东商品列表API接口、京东APP详情API接口、京东详情API接口,京东SKU信息接口
利用OPNET进行网络单播(一服务器多客户端)仿真的设计、配置及注意点
AIDL 与Service
How Alibaba cloud's DPCA architecture works | popular science diagram
消息队列:消息积压如何处理?
导航栏根据路由变换颜色
论文阅读【Sensor-Augmented Egocentric-Video Captioning with Dynamic Modal Attention】
Taobao Commodity details page API interface, Taobao Commodity List API interface, Taobao Commodity sales API interface, Taobao app details API interface, Taobao details API interface
Educational Codeforces Round 22 B. The Golden Age
Dj-zbs2 leakage relay