am i using findNextSibling wrong?

L

localpricemaps

i have this html:

<td class="price">

<a class="nojs" name="D1L4" href="/xPopups/nojs"
target="_blank">3.99</a>


<div class="food">1.05</div>


<div class="drink">3</div>

<a class="btn" name="D1" href="http://www.cnn.com"
target="_blank" onclick="reload()">

i tried to this use this python to scrape out the href cnn.com and
failed.

for incident in row('td', {'class':'price'}):
n = incident.findNextSibling('a')
b = n.findNextSibling('div')
c = b.findNextSibling('div')
d = c.findNextSibling('a', {'class': 'btn'}')
info = d['href'] + "','"
print info

and i tried this
for incident in row('td', {'class':'price'}):
n = incident.findNextSibling('a', {'class': 'btn'})
info = n['href'] + "','"
print info
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,255
Members
46,852
Latest member
CarlaDowle

Latest Threads

Top