Live data from Hacker News

Ask HN: What are the best tools for web scraping in 2022?

news.ycombinator.com

21–30 of 160 posts

Re: Ask HN: What are the best tools for web scraping in 2022?

#21
post #19

I've been using puppeteer as it's got a very established ecosystem. There are also puppeteer plugins that make it very powerful against captchas/detection/etc. The worst thing about Puppeteer is chrome and it's bad memory management so I'm going to give playwright a spin soon.

It's been a while, but last time I used it Puppeteer had a headless Firefox backend?

Re: Ask HN: What are the best tools for web scraping in 2022?

#22
post #3

In the world of SPA (single page applications), headless browser API is super helpful, playwright[1] and puppeteer[2] are very good choices. [1] https://github.com/microsoft/playwright [2] https://github.com/puppeteer/puppeteer

Also is the ability to open the Networks panel, to snoop on requests and find the exact API call that you might need to perform your task, instead of having to pull in all of HTML/JS/CSS crap. As a lot of SPAs have essentially pushed everything behind JSON APIs, all information is usually one (authenticated) API call away.

Most content heavy websites that tend to be scrapped, usually use server side rendering for this exact same reason, and put many obstacles in the way to make sure that data doesn't get scrapped easily. See: product price, stock, delivery information.

Re: Ask HN: What are the best tools for web scraping in 2022?

#24
post #19

I've been using puppeteer as it's got a very established ecosystem. There are also puppeteer plugins that make it very powerful against captchas/detection/etc. The worst thing about Puppeteer is chrome and it's bad memory management so I'm going to give playwright a spin soon.

It's been a while, but last time I used it Puppeteer had a headless Firefox backend?

You might be mistaking playwright with puppeteer

Re: Ask HN: What are the best tools for web scraping in 2022?

#26
i hate to be that guy, but “it depends”

scrapy is still king for me (scrapy.org). there are even packages to use headless browsers for those awful javascript heavy sites

however, APIs and RSS are still in play, and that does not require a heavy scraper. I am building vertical industry portals, and many of my data rollups consume APIs and structured XML/RSS feeds from social and other sites.

Re: Ask HN: What are the best tools for web scraping in 2022?

#27

Beautiful Soup gets the job done. I made several app by using it. [1] https://github.com/altilunium/wistalk (Scrap wikipedia to analyze user's activity) [2] https://github.com/altilunium/psedex (Scrap goverment website to get list of all registered online services in Indonesia) [3] https://github.com/altilunium/makalahIF (Scrap university lecturer's web page to get list of papers) [4] https://github.com/altilunium/wi…

I've found lxml to be more powerful. The lxml library supports xpaths, which I don't believe Beautiful Soup does?

In other words, consider lxml as well.

Re: Ask HN: What are the best tools for web scraping in 2022?

#28
post #19

I've been using puppeteer as it's got a very established ecosystem. There are also puppeteer plugins that make it very powerful against captchas/detection/etc. The worst thing about Puppeteer is chrome and it's bad memory management so I'm going to give playwright a spin soon.

It's been a while, but last time I used it Puppeteer had a headless Firefox backend?

Puppeteer can do both Chrome & Firefox, you're right. I use both for a scraping project I do.

Re: Ask HN: What are the best tools for web scraping in 2022?

#29
post #25

Selenium via Python is really useful too if you need to do a bit more (e.g clicks) than just fetching the html from the page.

Selenium can be very difficult to install when it comes to specific browser libraries.. Playwright, just as one example, is very easy to install.

Re: Ask HN: What are the best tools for web scraping in 2022?

#30

Can I piggyback on the question and ask what are people scraping these days?

Recently I wrote a small firefox extension to scrape only the Hacker News submissions which I upvoted, and also my own submissions, and create browser bookmarks from them.

It also scrapes all my comments I upvoted and if those have links inside them it creates bookmarks from them too.

That's because I often find myself searching for some submission I upvoted but can't find it, especially if there were many similar ones, whereas Firefox bookmarks manager has a nifty search feature...

I had to scrape since the HN API doesn't expose ability to get information about upvoted submissions/comments. The extension assumes you are logged in, it doesn't ask for your username or password.

It's mostly for my own use and not very polished, but it works. I uploaded it to the Firefox extensions gallery, and you can probably find it there, but I don't think it's ready for public consumption yet...

Post reply on HN