我正在尝试删除易趣上的产品列表。我可以获得除图像来源之外的所有信息。我的查询检索图像的所有信息,例如alt、高度等,但不检索源。
One of the product link I am trying to scrape.
http://www.ebay.com.au/itm/REAR-RAISED-KING-SPRINGS-2-03-ON-TOYOTA-L-CRUISER-PRADO-120-150-GX-KTPR-102-/170945971135?pt=AU_Car_Parts_Accessories&hash=item27cd2c83bf
Query I used
$query1=".//*[@id='i_vv4-35']";
Test to chek if attribute exist returns nothing.
$element1->hasAttribute('src')
Get attribute method.
$element1->getAttribute('src')问候Abnab
发布于 2013-02-14 11:13:52
这是因为eBay实际上并没有使用<img>元素,这可能是为了阻止您和其他人做您想做的事情。该图像是一个背景设置为该图像的<a>元素:
background: url(http://q.ebaystatic.com/aw/pics/s.gif) no-repeat 0 0;您需要解析css,并从要查找的元素的声明中提取背景属性。
https://stackoverflow.com/questions/14867166
复制相似问题