Scrapy 1.3 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes http://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = [ 'http://quotes.toscrape.com/tag/humor/', ] def parse(self, response):0 码力 | 272 页 | 1.11 MB | 1 年前3Scrapy 0.14 Documentation
the Scrapy architecture. Downloader Middleware Customize how pages get requested and downloaded. Spider Middleware Customize the input and output of your spiders. Extensions Add any custom functionality name = Field() description = Field() size = Field() Write a Spider to extract the data The next thing is to write a Spider which defines the start URL (http://www.mininova.org/today), the rules information about XPath see the XPath reference [http://www.w3.org/TR/xpath]. Finally, here’s the spider code: class MininovaSpider(CrawlSpider): name = 'mininova.org' allowed_domains = ['mininova0 码力 | 235 页 | 490.23 KB | 1 年前3Scrapy 0.14 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 i 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . size = Field() 5 Scrapy Documentation, Release 0.14.4 2.1.3 Write a Spider to extract the data The next thing is to write a Spider which defines the start URL (http://www.mininova.org/today), the rules XPath reference. 6 Chapter 2. First steps Scrapy Documentation, Release 0.14.4 Finally, here’s the spider code: class MininovaSpider(CrawlSpider): name = 'mininova.org' allowed_domains = ['mininova.org']0 码力 | 179 页 | 861.70 KB | 1 年前3Scrapy 2.10 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 6.4 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes https://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = [ "https://quotes.toscrape.com/tag/humor/", ] def parse(self, response):0 码力 | 419 页 | 1.73 MB | 1 年前3Scrapy 1.2 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes http://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = [ 'http://quotes.toscrape.com/tag/humor/', ] def parse(self, response):0 码力 | 266 页 | 1.10 MB | 1 年前3Scrapy 2.6 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes https://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = 'quotes' start_urls = [ 'https://quotes.toscrape.com/tag/humor/', ] def parse(self, response):0 码力 | 384 页 | 1.63 MB | 1 年前3Scrapy 1.6 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes http://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = 'quotes' start_urls = [ 'http://quotes.toscrape.com/tag/humor/', ] def parse(self, response):0 码力 | 295 页 | 1.18 MB | 1 年前3Scrapy 2.9 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes https://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = [ "https://quotes.toscrape.com/tag/humor/", ] def parse(self, response):0 码力 | 409 页 | 1.70 MB | 1 年前3Scrapy 2.8 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes https://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = 'quotes' start_urls = [ 'https://quotes.toscrape.com/tag/humor/', ] def parse(self, response):0 码力 | 405 页 | 1.69 MB | 1 年前3Scrapy 1.1 Documentation
Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 6.3 Spider Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . example spider In order to show you what Scrapy brings to the table, we’ll walk you through an example of a Scrapy Spider using the simplest way to run a spider. Here’s the code for a spider that scrapes http://quotes.toscrape.com, following the pagi- nation: import scrapy class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = [ 'http://quotes.toscrape.com/tag/humor/', ] def parse(self, response):0 码力 | 260 页 | 1.12 MB | 1 年前3
共 167 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17