Scrapy 0.16 Documentationoptions: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() item['description'] = ['id', 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name'] item['description'] = row['description']0 码力 | 203 页 | 931.99 KB | 1 年前3
Scrapy 0.16 DocumentationSupported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 272 页 | 522.10 KB | 1 年前3
Scrapy 0.18 Documentationoptions: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() item['description'] = ['id', 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name'] item['description'] = row['description']0 码力 | 201 页 | 929.55 KB | 1 年前3
Scrapy 0.22 Documentationoptions: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response url) sel = Selector(response) item = Item() item[’id’] = sel.xpath(’//td[@id="item_id"]/text()’).re(r’ID: (\d+)’) item[’name’] = sel.xpath(’//td[@id="item_name"]/text()’).extract() item[’description’] = = [’id’, ’name’, ’description’] def parse_row(self, response, row): log.msg(’Hi, this is a row!: %r’ % row) item = TestItem() item[’id’] = row[’id’] item[’name’] = row[’name’] item[’description’] = row[’description’]0 码力 | 199 页 | 926.97 KB | 1 年前3
Scrapy 0.20 Documentationoptions: • --callback or -c: spider method to use as callback for parsing the response • --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response url) sel = Selector(response) item = Item() item[’id’] = sel.xpath(’//td[@id="item_id"]/text()’).re(r’ID: (\d+)’) item[’name’] = sel.xpath(’//td[@id="item_name"]/text()’).extract() item[’description’] = = [’id’, ’name’, ’description’] def parse_row(self, response, row): log.msg(’Hi, this is a row!: %r’ % row) item = TestItem() item[’id’] = row[’id’] item[’name’] = row[’name’] item[’description’] = row[’description’]0 码力 | 197 页 | 917.28 KB | 1 年前3
Scrapy 0.20 DocumentationSupported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response Selector(response) item = Item() item['id'] = sel.xpath('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = sel.xpath('//td[@id="item_name"]/text()').extract() item['description'] 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 276 页 | 564.53 KB | 1 年前3
Scrapy 0.18 DocumentationSupported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response HtmlXPathSelector(response) item = Item() item['id'] = hxs.select('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = hxs.select('//td[@id="item_name"]/text()').extract() 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 273 页 | 523.49 KB | 1 年前3
Scrapy 0.22 DocumentationSupported options: --callback or -c: spider method to use as callback for parsing the response --rules or -r: use CrawlSpider rules to discover the callback (ie. spider method) to use for parsing the response Selector(response) item = Item() item['id'] = sel.xpath('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = sel.xpath('//td[@id="item_name"]/text()').extract() item['description'] 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 303 页 | 566.66 KB | 1 年前3
Scrapy 0.24 Documentationthrough pipelines 24 Chapter 3. Basic concepts Scrapy Documentation, Release 0.24.6 • --rules or -r: use CrawlSpider rules to discover the callback (i.e. spider method) to use for parsing the response %s' % response.url) item = scrapy.Item() item['id'] = response.xpath('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = response.xpath('//td[@id="item_name"]/text()').extract() item['description'] = ['id', 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] 36 Chapter 3. Basic concepts Scrapy Documentation0 码力 | 222 页 | 988.92 KB | 1 年前3
Scrapy 0.24 Documentationto use as callback for parsing the response --pipelines: process items through pipelines --rules or -r: use CrawlSpider rules to discover the callback (i.e. spider method) to use for parsing the response url) item = scrapy.Item() item['id'] = response.xpath('//td[@id="item_id"]/text()').re(r'ID: (\d+)') item['name'] = response.xpath('//td[@id="item_name"]/text()').extract() 'name', 'description'] def parse_row(self, response, row): log.msg('Hi, this is a row!: %r' % row) item = TestItem() item['id'] = row['id'] item['name'] = row['name']0 码力 | 298 页 | 544.11 KB | 1 年前3
共 62 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













