【发布时间】:2020-08-12 06:43:17
【问题描述】:
我正在尝试使用scrapy 和BeautifulSoup 来抓取这个link,但由于某种原因,BeautifulSoup 不能在蜘蛛中工作,它只能在scrapy shell 中工作。我知道这听起来很傻,但是,如何将其转换为 Xpath?
soup.find('li', {'class': 'at-listing__list-icons_location'})
我试过了
response.xpath('//li[contains(text(),"at-listing__list icons_location")]/../descendant::text()').extract()
请参阅my other question,其中包含了我尝试使用 splash 和 BeautifulSoup 使事情正常运行的日志,但到目前为止所有尝试都失败了。
【问题讨论】:
标签: xpath beautifulsoup scrapy