Errors with inconsistent tags are most likely caused by inconsistent tags. Browsers are famous for accepting sloppy html, and have made it easier for web coders to write poorly-formed html, so there are a lot of them. There is no reason to believe that creagslist should be protected from poor web page designers.
You need to use a grammar that allows for these inconsistencies. If the parser you are using does not allow you to correctly determine the grammar, you are stuck. (There might be a better Python library for this, but I don't know that).
One option is to launch a web page using a tool such as Tidy, which clears such inconsistencies and then launches your parser.
source
share