当前位置:网站首页>Requests crawl page source code data
Requests crawl page source code data
2022-07-24 07:30:00 【Can't fail I】
requests
- This is a web request based module in crawler
- effect : Simulate the browser to initiate a request .
- Coding process :
- 1. Appoint url
- 2. Initiate request
- 3. Get response data ( Crawled page source code data )
- 4. Persistent storage
1 Crawl the page source code data of Sogou homepage
import requests
# Appoint url
url = 'https://www.sogou.com/'
# Initiate request get The return value of the method is the corresponding object
response = requests.get(url=url)
# Obtain corresponding data
# .text: What is returned is the response data of string type
page_text = response.text
# Persistent storage
with open('./sougou.html', 'w', encoding='utf-8') as fp:
fp.write(page_text)
The effect after running
Follow the column for more details
边栏推荐
- Basic syntax of MySQL DDL and DML and DQL
- QoS服务质量三DiffServ模型报文的标记及PHB
- Induction, generalization, deduction
- Log in to the server using the fortress machine (springboard machine)
- QoS quality of service 4 traffic regulation of QoS boundary behavior
- django.db.utils. OperationalError: (2002, “Can‘t connect to local MySQL server through socket ‘/var/r
- Learning notes - distributed transaction theory
- mysql查询当前节点的所有父级
- 论文阅读:HarDNet: A Low Memory Traffic Network
- 归纳、概括、演绎
猜你喜欢
随机推荐
【FreeRTOS】11 软件定时器
Buffer overflow vulnerability of network security module B in national vocational college skills competition
nacos配置中心源码分析
Jay Chou's live broadcast was watched by more than 6.54 million people, with a total interaction volume of 450million, helping Kwai break the record again
Compilation and debugging (GCC, g++, GDB)
【HiFlow】腾讯云HiFlow场景连接器实现校园信息管理智能化
24.全局事件总线
MySQL语句
win10声音图标有个没有声音
剑指offer专项突击版第8天
Jackson parsing JSON detailed tutorial
[line test] Figure finding regular questions
Give a string ① please count the number of times each letter appears ② please print the pair with the most letters
Buddy: core function entry
stdafx.h 简介及作用
Paper reading: hardnet: a low memory traffic network
numpy.cumsum
PHP escape string
Decompress the anchor and enjoy 4000w+ playback, adding a new wind to the Kwai food track?
In the era of e-commerce, what should enterprises do in the transformation of social e-commerce?










