For following HTML, I want to parse it and get following result using Nokogiri.
event_name = "folk concert 2"
event_link = "http://www.douban.com/event/12761580/"
event_date = "20th,11,2010"
I know doc.xpath('//div[@class="nof clearfix"]')
could get each div
element, but how should I proceed to get each attribution like event_name
, and especially the date
?
HTML
<div class="nof clearfix">
<h2><a href="http://www.douban.com/event/12761580/">folk concert 2</a> <span class="pl2"> </span></h2>
<div class="pl intro">
Date:25th,11,2010<br/>
</div>
</div>
<div class="nof clearfix">
<h2><a href="http://www.douban.com/event/12761581/">folk concert </a> <span class="pl2"> </span></h2>
<div class="pl intro">
Date:10th,11,2010<br/>
</div>
</div>