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

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

Scrapy+Xpath+Python:無法抓取數據點

Scrapy+Xpath+Python:無法抓取數據點

慕妹3242003 2021-06-18 10:00:59
我想在這里抓取網址:我試過這些:response.xpath('//header[@class="geodir-entry-header"]/a/@href').extract()response.xpath('//div[class="geodir-content "]/header/a/@href').extract()response.xpath('//div[@class="geodir-content "]/header[@class="geodir-entry-header"]/a/@href').extract()都返回了一個空列表。
查看完整描述

2 回答

?
慕桂英4014372

TA貢獻1871條經驗 獲得超13個贊

response.xpath('//h3[@class="geodir-entry-title"]/a/@href').extract() 或者 response.xpath('//header[@class="geodir-entry-header"]/h3/a/@href').extract()

為你工作?

看起來您剛剛錯過了h3包含a您需要的標簽的標簽。


查看完整回答
反對 回復 2021-06-22
?
紫衣仙女

TA貢獻1839條經驗 獲得超15個贊

您所需要的只是添加您不小心錯過的 h3 標簽。

response.xpath('//header[@class="geodir-entry-header"]/h3/a/@href').extract()

&如果您只想獲取第一個網址,請?zhí)砑?/p>

response.xpath('//header[@class="geodir-entry-header"]/h3/a/@href').extract_first()

或者

response.xpath('//header[@class="geodir-entry-header"]/h3/a/@href').extract()[0]


查看完整回答
反對 回復 2021-06-22
  • 2 回答
  • 0 關注
  • 162 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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