Skip to content

How to parse if css selector is non-unique #4

@skanga

Description

@skanga

Consider this HTML snippet

<p class="attrgroup"><span><b>2001 KAWASAKI DRIFTER</b></span></p>
<p class="attrgroup">
<span>condition: <b>excellent</b></span>
<br><span>engine displacement (CC): <b>800</b></span>
<br><span>fuel: <b>gas</b></span>
<br><span>odometer: <b>17500</b></span>
<br><span>paint color: <b>red</b></span>
<br><span>title status: <b>clean</b></span>
<br><span>transmission: <b>manual</b></span><br>
</p>

In this case how do you extract "columns" for fuel, odometer, transmission, etc especially in the case when a) the order may be different and b) some fields may be missing.

Note: this snippet is taken from https://sfbay.craigslist.org/nby/mcy/5623911440.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions