第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何從站點中抓取項目名稱,并在執(zhí)行此操作時進入循環(huán)輸入項目鏈接并解析描述?

如何從站點中抓取項目名稱,并在執(zhí)行此操作時進入循環(huán)輸入項目鏈接并解析描述?

守候你守候我 2023-07-18 15:08:41
所以我對 scrapy 完全是新手,并試圖學習 scrapy。https://www.killertools.com/Dent-Removal-Aluminum-Steel_c_11.html 對于初學者,如果有超過一頁的產品可供瀏覽,我想從兩個頁面中的第一類別中的所有產品中刪除項目名稱。這就是我得到的并且有效:import scrapyclass QuotesSpider(scrapy.Spider):    name = 'killertools'    start_urls = ['https://www.killertools.com/Dent-Removal-Aluminum-Steel_c_11.html',              ]def parse(self, response):    for item in response.css('div.name'):        yield {'Name': item.xpath('a/text()').get()}    next_page = response.css('div.paging a:nth-child(4)::attr("href")').get()    if next_page is not None:        yield response.follow(next_page, self.parse)但我想進入每個產品鏈接并提取項目描述并將它們作為描述放入詞匯表中。我該如何去做呢?我嘗試過這樣的事情:import scrapyclass QuotesSpider(scrapy.Spider):    name = 'killertools'    start_urls = ['https://www.killertools.com/Dent-Removal-Aluminum-Steel_c_11.html',              ]def parse(self, response):    for item in response.css('div.name'):        yield {'Name': item.xpath('a/text()').get()}        detail_page = response.css('div.name a::attr("href")').get()        if detail_page is not None:            yield response.follow(detail_page)            for detail in response.css('div.item'):                yield {'Description': detail.xpath('p/strong/text').get()}    next_page = response.css('div.paging a:nth-child(4)::attr("href")').get()    if next_page is not None:        yield response.follow(next_page, self.parse)但它做了一些奇怪的事情,在我的水平上我無法真正理解這些事情。
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 86 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號