当前位置:网站首页>爬虫练习题(三)
爬虫练习题(三)
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'))



边栏推荐
- 利用OPNET进行网络仿真时网络层协议(以QoS为例)的使用、配置及注意点
- Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]
- Educational Codeforces Round 22 B. The Golden Age
- 利用OPNET进行网络任意源组播(ASM)仿真的设计、配置及注意点
- 高压漏电继电器BLD-20
- 【js组件】date日期显示。
- 删除文件时提示‘源文件名长度大于系统支持的长度’无法删除解决办法
- Leetcode: maximum number of "balloons"
- Mapbox Chinese map address
- 漏电继电器JD1-100
猜你喜欢
![[binary tree] binary tree path finding](/img/34/1798111e9a294b025806a4d2d5abf8.png)
[binary tree] binary tree path finding

Zero sequence aperture of leakage relay jolx-gs62 Φ one hundred

论文阅读【MM21 Pre-training for Video Understanding Challenge:Video Captioning with Pretraining Techniqu】

高压漏电继电器BLD-20

导航栏根据路由变换颜色

How Alibaba cloud's DPCA architecture works | popular science diagram

MySQL数据库学习(8) -- mysql 内容补充

CentOS 7.9 installing Oracle 21C Adventures

常用消息队列有哪些?

Jhok-zbl1 leakage relay
随机推荐
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
Lombok plug-in
sql查询:将下一行减去上一行,并做相应的计算
《2》 Label
JHOK-ZBG2漏电继电器
EGR-20USCM接地故障继电器
JVM (19) -- bytecode and class loading (4) -- talk about class loader again
论文阅读【Open-book Video Captioning with Retrieve-Copy-Generate Network】
DOM node object + time node comprehensive case
消息队列:重复消息如何处理?
Flink SQL realizes reading and writing redis and dynamically generates hset key
不同网段之间实现GDB远程调试功能
App clear data source code tracking
实现网页内容可编辑
Record a pressure measurement experience summary
Unity keeps the camera behind and above the player
Educational Codeforces Round 22 B. The Golden Age
Writing process of the first paper
np. random. Shuffle and np Use swapaxis or transfer with caution
How does mapbox switch markup languages?