0

我正在尝试抓取 nordstrom 产品描述。我得到了所有项目链接(存储在本地 mongodb 数据库中),现在正在遍历它们,这是一个示例链接https://www.nordstrom.ca/s/leith-ruched-body-con-tank-dress/5420732 ?origin=category-personalizedsort&breadcrumb=Home%2FWomen%2FClothing%2Fdresses&color=001

我的蜘蛛代码是:

def parse(self, response):
    items = NordstromItem()
    description = response.css("div._26GPU").css("div::text").extract()
    items['description'] = description
    yield items

我也试过scrapy shell,返回的页面是空白的。我也在使用scrapy随机代理。

4

1 回答 1

1

我建议您使用 css 或 xpath 选择器来获取您想要的信息。这里有更多关于它的信息:https ://docs.scrapy.org/en/latest/topics/selectors.html

您还可以使用 css/xpath 检查器来帮助确定选择器是否获得了您想要的信息。喜欢这个 Chrome 扩展:https ://autonomq.io/chropath/

于 2020-05-02T19:16:29.777 回答