News for hackers. Stuff that matters.
Re:Web Scraping in Python – The Complete Guide by f311a on Tuesday February 20, 2024 @01:44PM (#39445127)
>BeautifulSoup

> Features: Excellent HTML/XML parser, easy web scraping interface, flexible navigation and search.

It does not feature any parser. It’s basically a wrapper over lxml.

>lxml

> Features: Very fast XML and HTML parser.

It’s fast, but there are alternatives that are literally 5x faster.

This article is just another rewrite of a basic introduction. It’s not a guide, since it does mot describe any issues that you face in practice.

Re:Web Scraping in Python – The Complete Guide by cmdlineluser on Tuesday February 20, 2024 @02:07PM (#39445464)
I'm sorry but BeautifulSoup is not just a wrapper over lxml.

lxml even has a module for using beautifulsoup's parser.

> lxml can make use of BeautifulSoup as a parser backend

https://lxml.de/elementsoup.html

> A very nice feature of BeautifulSoup is its excellent support for encoding detection which can provide better results for real-world HTML pages that do not (correctly) declare their encoding.

Re:Web Scraping in Python – The Complete Guide by thrdbndndn on Tuesday February 20, 2024 @01:57PM (#39445320)
Beautiful Soup comes with a "html.parser", and by default it doesn't not use or even install lxml.
Re:Web Scraping in Python – The Complete Guide by antisthenes on Tuesday February 20, 2024 @04:58PM (#39447506)
Parsing HTML super-fast is very low on the list of priorities when web-scraping things. Yes, in practice.

Most of the time it won't even register on the scale, compared to the time spent sending/receiving requests and data.

Re:Web Scraping in Python – The Complete Guide by labaron on Wednesday February 21, 2024 @08:00AM (#39453228)
lxml is written in Cython and is very efficient in my tests. Much faster than BeautifulSoup, which is pure Python.

What alternatives are 5x faster?