Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python Weekend - 2015 - Raspando a web com Scrapy

Python Weekend - 2015 - Raspando a web com Scrapy

Apresentado durante o Python Weekend 2015 realizado em Feira de Santana - Ba.

Diego Leite

March 16, 2015
Tweet

More Decks by Diego Leite

Other Decks in Technology

Transcript

  1. Raspando a web com Scrapy “Para fazer raspagem de dados

    não precisa de lixa e nem espátula”
  2. Sobre o Scrapy Lançamento: 26 de junho de 2008 Última

    versão estável: 0.24.4 Linguagem: Python Sistemas Operacionais: Mac/Windows/Linux Licença: BSD Site: scrapy.org
  3. XPath table nodename Selects all nodes with the name "nodename"

    / Selects from the root node // Selects nodes in the document from the current node that match the selection no matter where they are . Selects the current node .. Selects the parent of the current node @ Selects attributes
  4. O que é um crawler? “É um programa que navega

    na estrutura de arquivos do site em busca de dados” - Eu
  5. Como fazer um crawler? 1 - Entender a lógica do

    site alvo 2 - Localizar os dados de interesse 3 - Escolher uma ferramenta de Scraping, ou não 4 - Desenvolvimento do algoritmo planejamento execução --------------------------------------------------------------------------------------------------------------------------------------------
  6. Spider ❏ Herda de scrapy.spider.Spider ❏ Atributos chaves: ❏ name

    ❏ allowed_domains ❏ start_urls ❏ Método chave: ❏ parse (self, response)
  7. id = ‘di3goleite’ if contato == ‘facebook’: print ‘fb.com/’ +

    id elif contato == ‘twitter’: print ‘twitter.com/’ + id else: print ‘github.com/’ + id