scrapy爬取网页信息时,没有递归显示,而是在第一条中全部显示了


 def start_requests(self):
        url='https://my.qidian.com/bookcase/'
        yield Request(url,cookies=self.cookie_dict)

    def parse(self, response, **kwargs):
        list_selection=response.xpath("//tbody/tr")
        for one in list_selection:
            title=one.xpath('//b/a[2]/text()').extract_first()
            type = one.xpath('//b/a[1]/text()').extract_first()
            update=one.xpath('td[3]/text()').extract_first()
            author=one.xpath('td[4]/a/text()').extract_first()

            item=QidianLoginItem()
            item['title']=title
            item['type']=type
            item['update']=update
            item['author']=author

            yield item

结果就是

img


这里就会发现一个问题,就是它的title,type都是一样的,当查看详细内容是发现:

img


他们的title,type在全部显示在一个title中,这是为什么,求大家帮忙讲解。

你是不是title和type取错值了。

img