Giter VIP home page Giter VIP logo

pokedex's Introduction

install with pip

pip3 install virtualenv

virtualenv myvenv

.\myvenv\Scripts\activate

pip install Scrapy

install with conda

conda create --name venv python=3.7

conda activate venv

conda install -c conda-forge scrapy

Creating a new Scrapy project

scrapy startproject tutorial

run spider

scrapy crawl quotes

shell

scrapy shell 'http://quotes.toscrape.com/page/1/' response.css('title') response.css('title::text').getall() response.xpath('//title/text()').get()

store data

scrapy crawl quotes -o quotes.json

Changing spider to recursively follow links

response.css('li.next a::attr(href)').get() response.css('li.next a').attrib['href']

for href in response.css('li.next a::attr(href)'): yield response.follow(href, callback=self.parse)

Using spider arguments

scrapy crawl quotes -o quotes-humor.json -a tag=humor

def __init__(self, *args, **kwargs):

    super(QDQSpider, self).__init__(*args, **kwargs)
    self.start_urls = [
        "http://es.qdq.com/"+ kwargs.get('category') +"/"
    ]

middleware

process_spider_input(response, spider): if response.status == 200 #do what ever you want print 'OK 200' else: print 'error on request. Retry'

pokedex's People

Contributors

edelblau 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.