【发布时间】:2020-07-28 00:01:45
【问题描述】:
我正在尝试抓取许多网站,但其中之一是 Shopify (AFAIK) 支持的“Lime Crime”。我正在使用 lxml 库,但是当我尝试使用 xpath 转到一个元素时,我得到了一个空数组,但它实际上存在于网页中。
import requests
from lxml import html
url = "https://limecrime.com/collections/unicorn-hair-full-coverage"
response = requests.get(url)
byte_data = response.content
source_code = html.fromstring(byte_data)
我试过source_code.cssselect("a.CF-Product__ImageWrapper") 或source_code.cssselect("CF-Product__ImageWrapper"),但没有成功。
谁能帮我获取产品的所有链接?
【问题讨论】:
标签: python web-scraping lxml