結果列のクラスを使用して、div 内のすべてをスクレイピングしようとしています。
これは、データを返さないクエリに使用しているコードです。
Elements el_name = doc.select(".div.results-column a.no-tracks.url");
Elements el_phone = doc.select(".div.results-column span.business-phone.phone");
Elements el_address = doc.select(".div.results-column span.street-address");
Elements el_city = doc.select(".div.results-column span.locality");
Elements el_state = doc.select(".div.results-column span.region");
Elements el_postalcode = doc.select(".div.results-column span.postal-code");
セレクターの概要は次のとおりです: http://jsoup.org/cookbook/extracting-data/selector-syntax
例:
<div class='results-column'>
<div class='listing-content'>
<span class='business-phone phone'>(111) 222-333</span><br>
<span class='no-tracks url'>www.example.com</span><br>
<span class='street-address'>29129 Sesame Street</span><span class='locality'>, Sesame City</span><br>
[Rest of information from result1 would be here, I don't need to list every single thing on SO I hope]
</div>
<span class='business-phone phone'>(111) 222-333</span><br>
<span class='no-tracks url'>www.example.com</span><br>
<span class='street-address'>29129 Sesame Street</span><span class='locality'>, Sesame City</span><br>
[Rest of information from result2 would be here, I don't need to list every single thing on SO I hope]
</div>
</div>
祖先の子演算子で特定のクラスの div を選択できませんか?