Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command for fetching Hacker News threads from the search API #2

Open
simonw opened this issue Jul 25, 2021 · 4 comments
Open

Command for fetching Hacker News threads from the search API #2

simonw opened this issue Jul 25, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Collaborator

simonw commented Jul 25, 2021

I want to be able to fetch every item for a domain, e.g. https://news.ycombinator.com/from?site=simonwillison.net

@simonw simonw added the enhancement New feature or request label Jul 25, 2021
@simonw
Copy link
Collaborator Author

simonw commented Jul 25, 2021

That page doesn't have an API but does look easy to scrape.

The other option here is the HN Search API powered by Algolia, documented at https://hn.algolia.com/api

@simonw
Copy link
Collaborator Author

simonw commented Jul 25, 2021

@simonw
Copy link
Collaborator Author

simonw commented Jul 25, 2021

Prototype:

curl "https://hn.algolia.com/api/v1/search_by_date?query=simonwillison.net&restrictSearchableAttributes=url&hitsPerPage=1000" | \
  jq .hits | sqlite-utils insert hn.db items - --pk objectID --alter

@simonw simonw changed the title Command for fetching Hacker News threads for a specific domain Command for fetching Hacker News threads from the search API Jul 25, 2021
@simonw
Copy link
Collaborator Author

simonw commented Jul 25, 2021

I'm going to build a general-purpose hacker-new-to-sqlite search ... command, where one of the options is to search within the URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant