Scrapy 2.4 Documentationyield { 'author': quote.xpath('span/small/text()').get(), 'text': quote.css('span.text::text').get(), } next_page = response.css('li.next a::attr("href")') if next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: quotes.jl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has not pleasure0 码力 | 445 页 | 668.06 KB | 1 年前3
Scrapy 2.4 Documentationquote in response.css('div.quote'): yield { 'author': quote.xpath('span/small/text()').get(), 'text': quote.css('span.text::text').get(), } next_page = response.css('li.next a::attr("href")').get() if next_page next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: scrapy runspider quotes.jl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has ˓→not pleasure0 码力 | 354 页 | 1.39 MB | 1 年前3
Scrapy 2.5 Documentationyield { 'author': quote.xpath('span/small/text()').get(), 'text': quote.css('span.text::text').get(), } next_page = response.css('li.next a::attr("href")') if next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: quotes.jl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has not pleasure0 码力 | 451 页 | 653.79 KB | 1 年前3
Scrapy 2.6 Documentationquote in response.css('div.quote'): yield { 'author': quote.xpath('span/small/text()').get(), 'text': quote.css('span.text::text').get(), } next_page = response.css('li.next a::attr("href")').get() if next_page next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: scrapy runspider quotes.jl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has␣ ˓→not pleasure0 码力 | 384 页 | 1.63 MB | 1 年前3
Scrapy 2.10 Documentationquote in response.css("div.quote"): yield { "author": quote.xpath("span/small/text()").get(), "text": quote.css("span.text::text").get(), } next_page = response.css('li.next a::attr("href")').get() if next_page next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: scrapy runspider quotes.jsonl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has␣ ˓→not pleasure0 码力 | 419 页 | 1.73 MB | 1 年前3
Scrapy 2.5 Documentationquote in response.css('div.quote'): yield { 'author': quote.xpath('span/small/text()').get(), 'text': quote.css('span.text::text').get(), } next_page = response.css('li.next a::attr("href")').get() if next_page next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: scrapy runspider quotes.jl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has␣ ˓→not pleasure0 码力 | 366 页 | 1.56 MB | 1 年前3
Scrapy 2.9 Documentationquote in response.css("div.quote"): yield { "author": quote.xpath("span/small/text()").get(), "text": quote.css("span.text::text").get(), } next_page = response.css('li.next a::attr("href")').get() if next_page next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: scrapy runspider quotes.jsonl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has␣ ˓→not pleasure0 码力 | 409 页 | 1.70 MB | 1 年前3
Scrapy 2.8 Documentationquote in response.css('div.quote'): yield { 'author': quote.xpath('span/small/text()').get(), 'text': quote.css('span.text::text').get(), } next_page = response.css('li.next a::attr("href")').get() if next_page next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: scrapy runspider quotes.jsonl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has␣ ˓→not pleasure0 码力 | 405 页 | 1.69 MB | 1 年前3
Scrapy 2.7 Documentationyield { 'author': quote.xpath('span/small/text()').get(), 'text': quote.css('span.text::text').get(), } next_page = response.css('li.next a::attr("href")') if next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: quotes.jsonl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has not pleasure0 码力 | 490 页 | 682.20 KB | 1 年前3
Scrapy 2.11 Documentationyield { "author": quote.xpath("span/small/text()").get(), "text": quote.css("span.text::text").get(), } next_page = response.css('li.next a::attr("href")') if next_page is not None: yield response.follow(next_page, self.parse) Put this in a text file, name it to something like quotes_spider.py and run the spider using the runspider command: quotes.jsonl file a list of the quotes in JSON Lines format, containing text and author, looking like this: {"author": "Jane Austen", "text": "\u201cThe person, be it gentleman or lady, who has not pleasure0 码力 | 528 页 | 706.01 KB | 1 年前3
共 62 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













