Scrapy入门———Scrapy1.6官方教程学习笔记

如果已经安装好了Scrapy,就可以开始下面的教程了。如果没有,可以看我的博文《安装Scrapy》进行安装后,再回来看哦!

接下来,我们将爬取 quotes.toscrape.com中的名人名言,作为本教程的素材。

入门教程共下列五步:

  1. 创建一个新的Scrapy项目
  2. 写一个spider去爬取网页和提取数据
  3. 使用命令行输出爬取的数据
  4. 根据链接递归爬取(爬取每一个链接)
  5. 使用spider 参数

创建一个Scrapy项目

在开始使用Scrapy之前,需要建立一个新的Scrapy项目。进入一个目录,输入下面命令,新建一个Scrapy项目
scrapy startproject tutorial
会建立一个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

        pi
  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Paperback: 270 pages Publisher: Packt Publishing - ebooks Account (January 30, 2016) Language: English ISBN-10: 1784399787 ISBN-13: 978-1784399788 Key Features Extract data from any source to perform real time analytics. Full of techniques and examples to help you crawl websites and extract data within hours. A hands-on guide to web scraping and crawling with real-life problems and solutions Book Description This book covers the long awaited Scrapy v 1.0 that empowers you to extract useful data from virtually any source with very little effort. It starts off by explaining the fundamentals of Scrapy framework, followed by a thorough description of how to extract data from any source, clean it up, shape it as per your requirement using Python and 3rd party APIs. Next you will be familiarised with the process of storing the scrapped data in databases as well as search engines and performing real time analytics on them with Spark Streaming. By the end of this book, you will perfect the art of scarping data for your applications with ease What you will learn Understand HTML pages and write XPath to extract the data you need Write Scrapy spiders with simple Python and do web crawls Push your data into any database, search engine or analytics system Configure your spider to download files, images and use proxies Create efficient pipelines that shape data in precisely the form you want Use Twisted Asynchronous API to process hundreds of items concurrently Make your crawler super-fast by learning how to tune Scrapy's performance Perform large scale distributed crawls with scrapyd and scrapinghub

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值