Scrapy 0.9 Documentation'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()") called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 204 页 | 447.68 KB | 1 年前3
Scrapy 0.9 Documentationr/\d+']), 'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()").extract() called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 156 页 | 764.56 KB | 1 年前3
Scrapy 0.14 Documentation'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()") called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 235 页 | 490.23 KB | 1 年前3
Scrapy 0.14 Documentationr/\d+']), 'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()").extract() called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 179 页 | 861.70 KB | 1 年前3
Scrapy 0.12 Documentation'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()") called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 228 页 | 462.54 KB | 1 年前3
Scrapy 0.12 Documentationr/\d+']), 'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()").extract() called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 177 页 | 806.90 KB | 1 年前3
Scrapy 1.4 Documentationstart_urls = [ 'http://quotes.toscrape.com/tag/humor/', ] def parse(self, response): for quote in response.css('div.quote'): yield { 'text': quote.css('span.text::text') extract_first(), } next_page = response.css('li.next a::attr("href")').extract_first() if next_page is not None: yield response.follow(next_page, self.parse) Put this in the URL for quotes in humor category) and called the default callback method parse, passing the response object as an argument. In the parse callback, we loop through the quote elements using a CSS Selector0 码力 | 394 页 | 589.10 KB | 1 年前3
Scrapy 0.18 Documentationr/\d+']), 'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()").extract() called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 201 页 | 929.55 KB | 1 年前3
Scrapy 0.16 Documentationr/\d+']), 'parse_torrent')] def parse_torrent(self, response): x = HtmlXPathSelector(response) torrent = TorrentItem() torrent['url'] = response.url torrent['name'] = x.select("//h1/text()").extract() called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 203 页 | 931.99 KB | 1 年前3
Scrapy 0.22 Documentation’/tor/\d+’]), ’parse_torrent’)] def parse_torrent(self, response): sel = Selector(response) torrent = TorrentItem() torrent[’url’] = response.url torrent[’name’] = sel.xpath("//h1/text()").extract() called with the downloaded Response object of each start URL. The response is passed to the method as the first and only argument. This method is responsible for parsing the response data and extracting scraped data (as scraped items) and more URLs to follow. The parse() method is in charge of processing the response and returning scraped data (as Item objects) and more URLs to follow (as Request objects). This0 码力 | 199 页 | 926.97 KB | 1 年前3
共 62 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













