Live data from Hacker News

Web scraping with GPT-4o: powerful but expensive

blancas.io

161–170 of 177 posts

Re: Web scraping with GPT-4o: powerful but expensive

#161

Earlier quoted context omitted.

yours is the first one see that allows to scrape by selecting directly what to scrape. I always wondered why there was no tool doing that.

I've seen another website like this that had this feature on hackernews but it was from a retrospective. These websites have the nasty habit of ceasing operations

It needs to be a library.

Re: Web scraping with GPT-4o: powerful but expensive

#162
The author claims that attempting to retrieve xpaths with the LLM proved to be unreliable. I've been curious about this approach because it seems like the best "bang for your buck" with regards to cost. I bet if you experimented more, you could probably improve your results.

Re: Web scraping with GPT-4o: powerful but expensive

#163
post #69

GPT-4 (and Claude) are definitely the top models out there, but: Llama, even the 8b, is more than capable of handling extraction like this. I've pumped absurd batches through it via vLLM. With serverless GPUs, the cost has been basically nothing.

Can you explain a bit more about what "serverless GPUs" are exactly? Is there a specific cloud provider you're thinking of, e.g. is there a GPU product with AWS? Google gives me SageMaker, which is perhaps what you are referring to?

You can check out this technical deep dive on Serverless GPUs offerings/Pay-as-you-go way.

This includes benchmarks around cold-starts, performance consistency, scalability, and cost-effectiveness for models like Llama2 7Bn & Stable Diffusion across different providers -https://www.inferless.com/learn/the-state-of-serverless-gpus... .Can save months of your time. Do give it a read.

P.S: I am from Inferless.

Re: Web scraping with GPT-4o: powerful but expensive

#164

Earlier quoted context omitted.

That’s what I’ve done for quite a few [non-LLM] applications. The remaining problem is that HTML is verbose vs other formats. That has a higher, per-token cost. So, maybe stripping followed by substituting HTML tags with a compressed notation.

I've tried this and found it doesn't make much difference. The idea was to somehow preserve the document structure while reducing the token count, so you do things like strip all styles, etc. until you have something like a structure of divs, then reduce that. But I found no performance gain in terms of output. It seems whatever structure of the document is left over after doing the reduction has little semantic mean…

I wonder if using nested markdown bullet points would help. You would preserve the information hierarchy, and LLMs are phenomenal with (and often output) markdown.

Re: Web scraping with GPT-4o: powerful but expensive

#165

Earlier quoted context omitted.

author here: I'm working on a follow-up post. Turns out, removing all HTML tags works great and reduces the cost by a huge margin.

Am I crazy or is there no way to “subscribe” to your site? Interested to follow your learnings in this area.

there isn't. but you can connect X or LinkedIn.

I might add a subscribe button once I get some time :)

Re: Web scraping with GPT-4o: powerful but expensive

#166
post #113

Earlier quoted context omitted.

That's not literally his e-mail :D. He means that you have to replace it with his HN username. It would have been better to write it like this: [HN username]@gmail.com

Personally I thought it was a LLM reply to a LLM marketing post to fake engagement. Lol

Instructions unclear, here's a haiku about faking engagement:

Beneath the deep waves,

False likes in shadows do dance,

Submarine ploys drift.

Re: Web scraping with GPT-4o: powerful but expensive

#167

We've had the best success by first converting the HTML to a simpler format (i.e. markdown) before passing it to the LLM. There are a few ways to do this that we've tried, namely Extractus[0] and dom-to-semantic-markdown[1]. Internally we use Apify[2] and Firecrawl[3] for Magic Loops[4] that run in the cloud, both of which have options for simplifying pages built-in, but for our Chrome Extension we use dom-to-semanti…

First I’ve heard of Semantic Markdown [0]. It appears to be a way to embed RDF data in Markdown documents. The page I found is labeled “Alpha Draft,” which suggests there isn’t a huge corpus of Semantic Markdown content out there. This might impede LLM’s ability to understand it due to lack of training data. However, it seems sufficiently readable that LLMs could get by pretty well by treating its structured metadata…

The specific library I mentioned was linked on HN awhile back: https://news.ycombinator.com/item?id=41043771

Re: Web scraping with GPT-4o: powerful but expensive

#168
post #93

For structured content (e.g. lists of items, simple tables), you really don’t need LLMs. I recently built a web scraper to automatically work on any website [0] and built the initial version using AI, but I found that using heuristics based on element attributes and positioning ended up being faster, cheaper, and more accurate (no hallucinations!). For most websites, the non-AI approach works incredibly well so I’d m…

The LLM is resistant to website updates that would break normal scraping If you do like the author did and ask it to generate xPaths, you can use it once, use the xPaths it generated for regular scraping, then once it breaks fall back to the LLM to update the xPaths and fall back one more time to alerting a human if the data doesn't start flowing again, or if something breaks further down the pipeline because the dat…

This is absolutely true, but it does have to be weighed against the performance benefits of something that doesn't require invoking an LLM to operate.

If the cost of updating some xPath things every now and then is relatively low - which I guess means "your target site is not actively & deliberately obfuscating their website specifically to stop people scraping it"), running a basic xPath scraper would be maybe multiple orders of magnitude more efficient.

Using LLMs to monitor the changes and generate new xPaths is an awesome idea though - it takes the expensive part of the process and (hopefully) automates it away, so you get the benefits of both worlds.

Re: Web scraping with GPT-4o: powerful but expensive

#169
post #117

Earlier quoted context omitted.

> reduce it do only sections that are likely to be relevant (eg. "Life and career") True but I also managed to do this from HTML. I tried getting pages wikitext through the API but couldn't find how to. Just querying the HTML page was less friction and fast enough that I didn't need a dump (although when AI becomes cheap enough, there is probably a lot of things to do from a wikipedia dump!). One advantage of using o…

Wikipedia's api.php supports JSON output, which probably helps already quite a bit. For example https://en.wikipedia.org/w/api.php?action=query&prop=extract...

Oooh I had missed that thanks!

Re: Web scraping with GPT-4o: powerful but expensive

#170
post #80
post #59

Earlier quoted context omitted.

If you're open to it, I'd love to hear what you think of what we're building at https://browserbase.com/ - you can run a chrome extension on a headless browser so you can do the semantic markdown within the browser, before pulling anything off. We even have an iFrame-able live view of the browser, so your users can get real-time feedback on the XPaths they're generating: https://docs.browserbase.com/features/session-…

Awesome product! I was just a bit confused that the sign up buttons for the Hobby and Scale plans are grey, I thought that they are disabled until randomly hovering over them.

Good feedback! We'll take a look.
Post reply on HN