On the page I have the following HTML source:
<div class="date">date1</div>
<div class="company"><div class="time">time1</div>
<a href="company_link1">company_name1</a></div>
<div class="company"><div class="time">time2</div>
<a href="company_link2">company_name2</a></div>
<div class="date">date2</div>
<div class="company"><div class="time">time3</div>
<a href="company_link3">company_name3</a></div>
... etc.
I need to receive at final stage the following array:
array = [ [date, time1, company_name1, company_link1], [date, time2, company_name2, company_link2], [date2, time3, company_name3, company_link3], … ]
The problem is that div “class=company” doesn’t have the date, so I need to parse the correct dates and add each date to all items (time, company name, company link).
Thanks a lot for your help, I’m a newbie to Ruby.
PS: I need to use mechanize cause my page can be retrieved only via log-in.
Hmm, your date2 div isn’t closed properly but maybe something like: