GithubHelp home page GithubHelp logo

bowlofstew / 3spiders-with-itemloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taroved/3spiders-with-itemloader

0.0 0.0 0.0 81 KB

3 scrapy spiders reimplemented with ItemLoader

Python 100.00%

3spiders-with-itemloader's Introduction

3 scrapy spiders implemented with ItemLoader

There are 3 spiders implemented with ItemLoader and without it. You can consider usage of ItemLoader for your spiders after reading the readme file until the end.

Table of Contents

Introduction

If you are a newbie in scrapy but have already written several spiders and gonna write more spiders, you should consider usage of ItemLoader if you don't use it yet. I will not describe features of ItemLoader and processors, check out official docs for this. But I will show migration from real world spiders without ItemLoader to spiders with ItemLoaders.

Migration steps

  1. Replace bare item field assignments with ItemLoader
  2. Usage of context selectors which simplify code
  3. Required step: add output processors
  4. Default output processor
  5. Optional step: extending ItemLoader

Installation

$ pip install scrapy
$ git clone [email protected]:taroved/3spiders-with-itemloader.git
# check contracts for spiders
$ cd 3spiders-with-itemloader
$ scrapy check

Scraping

$ scrapy crawl apple

Output scrapped data to the file and write log file:

$ scrapy crawl apple -o apple.json --logfile=apple.log

More spiders

The second spider scrape locations from wetseal.com:

$ scrapy crawl wetseal -o wetseal.json

The third spider scrape products from hhgregg.com:

$ scrapy crawl hhgregg -o hhgregg.json

Summary

I haven't said a lot, but you can take a look at the full diff between versions without and with ItemLoader for the spiders and make the right decision.

License

WTFPL

3spiders-with-itemloader's People

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.