News for hackers. Stuff that matters.
Re:Datasette’s new JSON write API: The first alpha of Datase... by simonw on Friday December 02, 2022 @06:55PM (#33838607)
I'm really pleased with the Hacker News scraping demo in this - it's an extension of the scraper I wrote back in March, using shot-scraper to execute JavaScript in headless Chrome and write the resulting JSON back to a Git repo: https://simonwillison.net/2022/Mar/14/scraping-web-pages-sho...

My new demo also then pipes that data up to Datasette using curl -X POST - this script here: https://github.com/simonw/scrape-hacker-news-by-domain/blob/...

Re:Datasette’s new JSON write API: The first alpha of Datase... by etrepum on Friday December 02, 2022 @07:09PM (#33838719)
Just a small note on the shot-scraper post (very cool stuff!): You can use Array.from(xs, fn) instead of Array.from(xs).map(fn). Same semantics but it happens in one pass with less garbage.
Re:Datasette’s new JSON write API: The first alpha of Datase... by simonw on Friday December 02, 2022 @07:13PM (#33838755)
I keep on forgetting that shortcut, thanks!