惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News - Newest:
Hacker News - Newest: "LLM"
Project Zero
Project Zero
The Hacker News
The Hacker News
博客园 - Franky
博客园_首页
云风的 BLOG
云风的 BLOG
T
Tenable Blog
腾讯CDC
量子位
大猫的无限游戏
大猫的无限游戏
Cyberwarzone
Cyberwarzone
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
宝玉的分享
宝玉的分享
T
The Blog of Author Tim Ferriss
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
Vercel News
Vercel News
Blog — PlanetScale
Blog — PlanetScale
The Cloudflare Blog
G
Google Developers Blog
Security Latest
Security Latest
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
O
OpenAI News
AWS News Blog
AWS News Blog
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
C
Cisco Blogs
T
Tor Project blog
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
D
Docker
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Help Net Security
Help Net Security

mafeifan 的编程技术分享

mafengwo-mp3-downloader | mafeifan 的编程技术分享 示例页面 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 查看 default namespace 下的 default service account名称 mafeifan 的编程技术分享 检查日志 | mafeifan 的编程技术分享 bridge fdb show dev flannel.1 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 数据收集原理分析 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 几种方法 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 check the export on the very top of this document so we can use $do mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 延伸 -- 关于前端路由 xdebug 3 和 2 的区别
mafeifan 的编程技术分享
2026-01-16 · via mafeifan 的编程技术分享

网络爬虫:是一种自动爬取网站内容信息的程序,被广泛运用于搜索引擎和数据挖掘等领域。 网络爬虫的基本执行流程:下载页面 - 提取页面中的数据 - 提取页面中的链接 Scrapy:是一个由Python语言编写的开源的网络爬虫框架,特点:使用简单,跨平台,灵活易拓展等。

安装 ​

本机环境 Mac 10.14, Python3 pip3 install scrapy 安装成功后 scrapy -h 查看包含的命令

安装过程中出现了一堆 error: unknown type name 'uint64_t' 错误 网上搜索 sudo mv /usr/local/include /usr/local/include_old 重新执行安装命令,安装成功后再恢复即可

image.png

创建一个项目 scrapy startproject tutorial

会生成以下文件

tutorial/
    scrapy.cfg            # deploy configuration file
    tutorial/             # project's Python module, you'll import your code from here
        __init__.py
        items.py          # project items definition file
        middlewares.py    # project middlewares file
        pipelines.py      # project pipelines file
        settings.py       # project settings file
        spiders/          # a directory where you'll later put your spiders
            __init__.py

编写第一个爬虫 ​

其实就是写一个类 创建文件 quotes_spider.py 放到 tutorial/spiders 目录

import scrapy

class QuotesSpider(scrapy.Spider):
   # 爬虫名,唯一标示,会在命令行中用到
    name = "quotes"

    def start_requests(self):
        urls = [
            'http://quotes.toscrape.com/page/1/',
            'http://quotes.toscrape.com/page/2/',
        ]
        for url in urls:
            yield scrapy.Request(url=url, callback=self.parse)

    def parse(self, response):
        page = response.url.split("/")[-2]
        filename = 'quotes-%s.html' % page
        with open(filename, 'wb') as f:
            f.write(response.body)
        self.log('Saved file %s' % filename)

来到项目的根目录,执行scrapy crawl quotes 显示过程

image.png

结果:发现多出了两个 html 文件,等于我们把网页抓取下来了。

参考:https://docs.scrapy.org/en/1.6/intro/tutorial.html