Scrapy web crawling con python
Hoy os voy a comentar sobre scrapy un framework en python como no! que estoy investigando muy potente, basicamente sirve para leer contenido web y extraer la información que queramos...
class MininovaSpider(CrawlSpider):
domain_name = 'mininova.org'
start_urls = ['http://www.mininova.org/today']
rules = [Rule(SgmlLinkExtractor(allow=['/tor/\d+']), 'parse_torrent')]
def parse_torrent(self, response):
x = HtmlXPathSelector(response)
torrent = ScrapedItem()
torrent.url = response.url
torrent.name = x.x("//h1/text()").extract()
torrent.description = x.x("//div[@id='description']").extract()
torrent.size = x.x("//div[@id='info-left']/p[2]/text()[2]").extract()
return [torrent]
En este ejemplo podeis ver como facilmente extraemos el titulo, la descripción, el enlace y el tamaño, os dejo a vuestra imaginación lo podemos llegar a hacer



