am i using findNextSibling wrong?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • localpricemaps@gmail.com

    #1

    am i using findNextSibling wrong?

    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.findNe xtSibling('a')
    b = n.findNextSibli ng('div')
    c = b.findNextSibli ng('div')
    d = c.findNextSibli ng('a', {'class': 'btn'}')
    info = d['href'] + "','"
    print info

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

Working...