home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where author_association = "MEMBER" and "created_at" is on date 2021-07-25 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: issue_url, created_at (date), updated_at (date)

issue 2

  • Command for fetching Hacker News threads from the search API 4
  • Use HN algolia endpoint to retrieve trees 3

user 1

  • simonw 7

author_association 1

  • MEMBER · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
886241674 https://github.com/dogsheep/hacker-news-to-sqlite/issues/3#issuecomment-886241674 https://api.github.com/repos/dogsheep/hacker-news-to-sqlite/issues/3 IC_kwDODtX3eM400vmK simonw 9599 2021-07-25T18:41:17Z 2021-07-25T18:41:17Z MEMBER

Got a TIL out of this: https://til.simonwillison.net/jq/extracting-objects-recursively

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Use HN algolia endpoint to retrieve trees 952189173  
886237834 https://github.com/dogsheep/hacker-news-to-sqlite/issues/3#issuecomment-886237834 https://api.github.com/repos/dogsheep/hacker-news-to-sqlite/issues/3 IC_kwDODtX3eM400uqK simonw 9599 2021-07-25T18:05:32Z 2021-07-25T18:05:32Z MEMBER

If you hit the endpoint for a comment that's part of a thread you get that comment and its recursive children: https://hn.algolia.com/api/v1/items/27941552

You can tell that it's not the top-level because the parent_id isn't null. You can use story_id to figure out what the top-level item is.

json { "id": 27941552, "created_at": "2021-07-24T15:08:39.000Z", "created_at_i": 1627139319, "type": "comment", "author": "nine_k", "title": null, "url": null, "text": "<p>I wish ...", "points": null, "parent_id": 27941108, "story_id": 27941108 }

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Use HN algolia endpoint to retrieve trees 952189173  
886142671 https://github.com/dogsheep/hacker-news-to-sqlite/issues/3#issuecomment-886142671 https://api.github.com/repos/dogsheep/hacker-news-to-sqlite/issues/3 IC_kwDODtX3eM400XbP simonw 9599 2021-07-25T03:51:05Z 2021-07-25T03:51:05Z MEMBER

Prototype:

curl 'https://hn.algolia.com/api/v1/items/27941108' \
  | jq '[recurse(.children[]) | del(.children)]' \
  | sqlite-utils insert hn.db items - --pk id
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Use HN algolia endpoint to retrieve trees 952189173  
886140431 https://github.com/dogsheep/hacker-news-to-sqlite/issues/2#issuecomment-886140431 https://api.github.com/repos/dogsheep/hacker-news-to-sqlite/issues/2 IC_kwDODtX3eM400W4P simonw 9599 2021-07-25T03:12:57Z 2021-07-25T03:12:57Z MEMBER

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.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Command for fetching Hacker News threads from the search API 952179830  
886136224 https://github.com/dogsheep/hacker-news-to-sqlite/issues/2#issuecomment-886136224 https://api.github.com/repos/dogsheep/hacker-news-to-sqlite/issues/2 IC_kwDODtX3eM400V2g simonw 9599 2021-07-25T02:08:29Z 2021-07-25T02:08:29Z MEMBER

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
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Command for fetching Hacker News threads from the search API 952179830  
886135922 https://github.com/dogsheep/hacker-news-to-sqlite/issues/2#issuecomment-886135922 https://api.github.com/repos/dogsheep/hacker-news-to-sqlite/issues/2 IC_kwDODtX3eM400Vxy simonw 9599 2021-07-25T02:06:20Z 2021-07-25T02:06:20Z MEMBER

https://hn.algolia.com/api/v1/search_by_date?query=simonwillison.net&restrictSearchableAttributes=url looks like it does what I want.

https://hn.algolia.com/api/v1/search_by_date?query=simonwillison.net&restrictSearchableAttributes=url&hitsPerPage=1000 - returns 1000 at once.

Otherwise you have to paginate using &page=2 etc - up to nbPages pages.

https://www.algolia.com/doc/api-reference/api-parameters/hitsPerPage/ says 1000 is the maximum.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Command for fetching Hacker News threads from the search API 952179830  
886135562 https://github.com/dogsheep/hacker-news-to-sqlite/issues/2#issuecomment-886135562 https://api.github.com/repos/dogsheep/hacker-news-to-sqlite/issues/2 IC_kwDODtX3eM400VsK simonw 9599 2021-07-25T02:01:11Z 2021-07-25T02:01:11Z MEMBER

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

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Command for fetching Hacker News threads from the search API 952179830  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 484.928ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows