我试图抓取网站抓取特定的XPath,从产品页面我试图报废产品的说明,而是如何选择只产品说明:如何限制蜘蛛使用scrapy
xPath : hxs.select('//div[@class="product-shop"]/p/text()').extract()
的HTML是相当大的,所以请参见上面指定的链接..
我想只需要选择产品说明中没有其他细节...
如果我这样做:
[" ".join([i.strip() for i in hxs.select('//div[@class="product-shop"]/p/text()').extract()])]
output :
[u'Itemcode: 12BTS28271 Brand: BASICS InStock - Ships within 2 business days. Tip: 90% of our shipments reach within 4 business days! This product is part of the Basics T.shirts line made of 100% Cotton. Stripes Muscle Fit T.shirts that come in Green Color. Casual that comes with Henley away.']
但我只想:在镀铬元素面板中的元素
[u'This product is part of the Basics T.shirts line made of 100% Cotton. Stripes Muscle Fit T.shirts that come in Green Color. Casual that comes with Henley away.']
是否有任何正则表达式或东西,以避免不必要的xPath –