Live data from Hacker News

Beautiful Soup

crummy.com

1–10 of 95 posts

Re: Beautiful Soup

#2
We used this in a project many suns ago and we ended up switching to libxml2, less pretty presentation, but more functional. YMMV.

Re: Beautiful Soup

#4
post #2

We used this in a project many suns ago and we ended up switching to libxml2, less pretty presentation, but more functional. YMMV.

bs4 introduced some very nice features over bs3, if that's what you were using, and includes the ability to use libxml2 as a parser. For very simple things though libxml2 would be a better fit.

Re: Beautiful Soup

#5

I find this to be a better version of the docs: https://beautiful-soup-4.readthedocs.io/en/latest/# Just in case someone wants a comment overview of what this superbly named library is: web scraping (html parsing) in python

The crummy.com page includes several suggestions to subscribe to Tidelift.

Re: Beautiful Soup

#7
How helpful is this when you're dealing with a website that does not degrade gracefully and insists using JavaScript to shove things in where a static webpage would work? (For example, scraping football scores from NFL.com)

Re: Beautiful Soup

#8
Great memories with this library, one of my all time favs.

It is fast? no.

But it had a fantastic mission: extracting data from malformed HTML.

Might be less common now but back then (~10+ years ago) it was still rampant. Many if not most parsers would barf on any deviation from the standard, leaving you to hand-roll regex solutions and ugly corner cases.

BS covered a LOT of these cases without forcing you to write terrible code. It mostly just worked, with a reasonable API, and stellar, well-written, example-laden docs.

Re: Beautiful Soup

#9
post #2

We used this in a project many suns ago and we ended up switching to libxml2, less pretty presentation, but more functional. YMMV.

bs4 introduced some very nice features over bs3, if that's what you were using, and includes the ability to use libxml2 as a parser. For very simple things though libxml2 would be a better fit.

bs4 is able to parse some malformed documents that libxml2 chokes on.

For these cases it can be useful to do the reverse, and use the BeautifulSoup HTML parser as an alternative parser backend for the lxml package: https://lxml.de/elementsoup.html

Post reply on HN