A little bit of If statements, some html investigating, and the webbrowser
I have a code that retrieves all the "place names" and all the "addresses" separately in this link:
http://www.yellowpages.ca/search/si-geo/1开发者_开发技巧/sh/Ottawa,+ON
I need to modify my code so that it will only retrieve the placename
and address
if
<div class="address""> is not found within <div class="listingDetail"">
class="address"
is the address of the location, class="listingDetail"
is the parent, or container. Some screenshots, please view them for better understanding:
If you use javascript use:
var addresses = Array.filter( document.getElementsByClassName('listingDetail'), function(listingDetail){
return listingDetail.getElementsByClassName('address');
});
精彩评论