Skip to content

Comment on Fake HN titles generated by GPT-3parent

Comments

No ability to directly download threads with a single request, for one, or query it like a database to sort or filter results, exclude unwanted fields, etc.

Those things should be trivial to achieve with most general purpose languages, as the API is so simple. No need for pagination or other things, just request things by ID recursively and you get the full thing, then after than filter/select whatever you want.

Pseudo-code to show how simple it would be:

    function get_thread(id) {
      let item = http.get(`{api}/?id={id}`).body
      if item.childs {
        item.fetched_children = item.childs.map((id) => {
          return get_thread(id)
        })
      }
      return item
    }
(untested, but you don't really need more than that, besides checking if the item was deleted)

Yes, and i've done it. But you still wind up having to make a separate request for each item, which makes building threads incredibly slow. It's also a waste of time if you're filtering out anything, because you still have to make the request and download the item to filter it out.

Which is why it would be preferable for the API itself to support these features.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.