簡體   English   中英

我無法用 scrapy 提取這個 url

[英]I can't extract this url with scrapy

嗨,我嘗試使用 xpath 提取 url 圖像。 我在 chrome Html 中有 xpathHelper 擴展:

<source src="https://estaticos.test.com/test/117/452/img1.jpg">

在 scrapy 我試試這個

ml_item['img2'] = response.xpath(
        '//*/picture/source[2]/@src').extract()

並嘗試

ml_item['img2'] = response.xpath(
        '/html/body/div/div/div/div[1]/main/div/div[1]/div[2]/div[1]/picture/img[1]').extract()

但不起作用,返回空,在 xpathhelper 中返回正確的 url。 與其他圖像 url 我沒有任何問題。 我與其他圖像一起使用ml_item['image_urls'] = response.xpath( '//*[contains(@class,"detail-gallery")]/div/div/div/img/@src').extract()它有效

我使用鉻和 firefox

嗨嘗試使用這個 Xpath 表達式:

(//圖片[@class='image-wrapper']/img)[1]/@src

response.xpath('//*[@class="main-info"]//img[@class="image"]/@src').extract_first()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM