chatgpt-api/docs/tools/hacker-news.mdx

43 wiersze
963 B
Plaintext
Czysty Zwykły widok Historia

2024-08-07 02:19:51 +00:00
---
title: HackerNews
description: Basic client for the official Hacker News API.
---
Note that the [HN Algolia API](https://hn.algolia.com/api) seems to no longer be available, so we can't add search without quite a bit of overhead.
- package: `@agentic/hacker-news`
- exports: `class HackerNewsClient`, `namespace hackernews`
2024-08-17 12:02:01 +00:00
- env vars: `HACKER_NEWS_API_USER_AGENT` _(optional)_
2024-08-07 02:19:51 +00:00
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/hacker-news/src/hacker-news-client.ts)
2024-08-17 11:03:17 +00:00
- [HN api docs](https://github.com/HackerNews/API)
2024-08-07 02:19:51 +00:00
## Install
<CodeGroup>
```bash npm
npm install @agentic/hacker-news
```
```bash yarn
yarn add @agentic/hacker-news
```
```bash pnpm
pnpm add @agentic/hacker-news
```
</CodeGroup>
## Usage
```ts
import { HackerNewsClient } from '@agentic/hacker-news'
const hn = new HackerNewsClient()
2025-03-01 13:08:44 +00:00
const res = await hn.searchItems({
query: 'example query',
tags: ['story'],
numericFilters: ['points>100']
})
2024-08-07 02:19:51 +00:00
```