I have these 2 queries:
1) Get all the URL of the images:
$imgs = $xpath->query('//div[@class="pin"]/div[@class="PinHolder"]/a/img');
2) Get how many people facebook-liked every image:
foreach($xpath->query('//span[@class="LikesCount"]') as $span) {
$int = (int) $span->nodeValue;
if ($int > 5) {
echo $i++ . "--> " . $int . "<br />";
}
}
I'd like to merge them to get just the images which has been facebook-liked more than 5 times
That said, pictures that hasn't been liked don't have the LikesCount class at all.
Follow an example of the Markup:
<div class="pin">
[...]
<a href="/pin/56787645270909880/" class="PinImage ImgLink">
<img src="http://media-cache-ec3.pinterest.com/upload/56787645270909880_d7AaHYHA_b.jpg"
alt="Krizia"
data-componenttype="MODAL_PIN"
class="PinImageImg"
style="height: 288px;">
</a>
<p class="stats colorless">
<span class="LikesCount">
22 likes
</span>
<span class="RepinsCount">
6 repins
</span>
</p>
[...]
</div>