[MRG+1] Update broken Scrapy tutorial to use quotes.toscrape.com #2236
Conversation
Current coverage is 83.36% (diff: 100%)
|
docs/intro/tutorial.rst
Outdated
desc = sel.xpath('text()').extract() | ||
print title, link, desc | ||
for quote in response.xpath('//div[@class="quote"]'): | ||
text = quote.xpath('span[@class="text"]/text()').extract() |
eliasdorneles
Sep 14, 2016
Member
It would be nicer to use extract_first() here instead.
It would be nicer to use extract_first() here instead.
docs/intro/tutorial.rst
Outdated
|
||
response.xpath('//ul/li/a/text()').extract() | ||
response.xpath('//div[@class="quote"]/span[@class="text"]/text()').extract() |
eliasdorneles
Sep 14, 2016
Member
It's a bit odd to say "From each code block" and then use response.xpath()
, because it returns all quotes extracted in a list.
I realize this will be rewritten later, but to prevent from getting inconsistencies into master, we could use text like To get the text for each quote:
It's a bit odd to say "From each code block" and then use response.xpath()
, because it returns all quotes extracted in a list.
I realize this will be rewritten later, but to prevent from getting inconsistencies into master, we could use text like To get the text for each quote:
@eliasdorneles: LGTM |
Many thanks @stummjr and @eliasdorneles ! |
redapple
added a commit
that referenced
this pull request
Sep 15, 2016
[backport][1.1] Tutorial update (PR #2236)
This was referenced Sep 19, 2016
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Please, don't merge this yet because it's a WIP. For now, we have the old tutorial ported for quotes.toscrape.com, but we will now rewrite it.
This PR aims to fix #2233