Scrapy website home page list into the detailed page, the detailed page needs to turn the page how to achieve?

what if the url starts from the list page, and after the list also grabs the title and other information, the traversed list enters the detail page according to the title, and there are multiple pages of url in this detail page that need to be followed (for example, an article has 1 page, 2 pages, 3 pages)? What should item do with it?
for example, Baidu Tieba, from the home page list!
, grab the relevant information here and then enter the post to grab all the buildings

.
Jul.04,2021

this is very simple. After start_request, scrapy will use the parse method by default. Of course, you can also define other methods to resolve, and then in the parse method, parse to get the link to the specific details page, and then again yield Request (url=' details page link', callback=self.parse) this form of cycle to take the next page, but there will be a hole, but I think your two layers should be almost enough. I don't bother to mention this pit.


Hello, I have encountered the same obstacle as you, but I can help you with the item save. The
format is as follows:
use the
yield Request (url=' detail page link in the list interface, and callback=self.detail_parse (detail_parse is the detail page parsing), mata {'item':item})

use
item = response.meta [' item']
in the detail_parse method, so the two methods share an item variable

.
Menu