Re:Web Scraping 101 with Python
by wslh on Sunday March 10, 2013 @06:28PM
(#5353824)
In my experience lxml.html is much better.
[ Parent
| on HN ]
The article shows that BeautifulSoup can use lxml internally. It can also use html5lib.
I'll second, lxml.html is in my experience very robust and fast. I've been writing a lot of scrapers along the years and the best combination I found so far is requests / lxml.html / gevent.
It doesn't get any simpler than this IMO http://pastebin.com/hacxmAjV
For fun here's the Ruby+Nokogiri version and my attempt at the Clojure+Enlive version (3rd day learning Clojure).
Pretty nice. I'd like to see how it goes in a real world scenario with concurrency, manipulation of extracted nodes and general HTTP post/auth/etc. I'm not sure about Ruby+Nokogiri but Clojure+Enlive may well be a great choice.