Code Monkey home page Code Monkey logo

scrapystudy's Introduction

##安装Scrapy框架

scrapy start project [projectname]

##创建爬虫

scrapy genspider example example.com

##获取数据

#response是一个'scrapy.http.response.html.HtmlResponse'对象,可执行'xpath'和'css'方法获取数据。
response.xpath()#返回selectorList
response.xpath().xpath()#返回selector
#getall获取全部文本返回一个列表

##运行命令行

from scrapy import cmdline
cmdline.execute(""scrapy crawl qsbk_spider".split()")

##数据解析

#yleid 返回数据提交到pipline处理
#pipline获得数据将其转换成json数据格式。

###JsonItemExporter和JsonLinesItemExporter:

  • 保存json数据的时候,可以使用这两个类,让操作变更简单。

scrapystudy's People

Contributors

kotodian avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.