chatgpt-api/bin/scratch.ts

53 wiersze
1.3 KiB
TypeScript
Czysty Zwykły widok Historia

2024-05-21 13:52:06 +00:00
#!/usr/bin/env node
import 'dotenv/config'
import { gracefulExit } from 'exit-hook'
import restoreCursor from 'restore-cursor'
2024-05-27 01:15:17 +00:00
// import { SearxngClient } from '../src/services/searxng-client.js'
2024-05-22 08:11:36 +00:00
// import { ClearbitClient } from '../src/index.js'
2024-05-26 23:11:56 +00:00
// import { ProxycurlClient } from '../src/services/proxycurl-client.js'
2024-06-02 00:34:25 +00:00
import { WikipediaClient } from '../src/index.js'
2024-05-21 13:52:06 +00:00
/**
2024-05-22 08:15:09 +00:00
* Scratch pad for testing.
2024-05-21 13:52:06 +00:00
*/
async function main() {
restoreCursor()
2024-05-22 08:11:36 +00:00
// const clearbit = new ClearbitClient()
// const res = await clearbit.companyEnrichment({
// domain: 'https://clay.com'
// })
// console.log(JSON.stringify(res, null, 2))
2024-05-26 23:11:56 +00:00
// const proxycurl = new ProxycurlClient()
// const res = await proxycurl.getLinkedInPerson({
// linkedin_profile_url: 'https://linkedin.com/in/fisch2'
// })
// console.log(JSON.stringify(res, null, 2))
2024-06-02 00:34:25 +00:00
const wikipedia = new WikipediaClient()
const res = await wikipedia.getPageSummary({
2024-06-03 00:12:22 +00:00
// title: 'Naruto_(TV_series)'
title: 'SpaceX'
2024-06-02 00:34:25 +00:00
})
console.log(JSON.stringify(res, null, 2))
2024-05-27 00:51:11 +00:00
2024-05-27 01:15:17 +00:00
// const searxng = new SearxngClient()
// const res = await searxng.search({
// query: 'golden gate bridge',
// engines: ['reddit']
// })
// console.log(JSON.stringify(res, null, 2))
2024-05-22 08:11:36 +00:00
2024-05-21 13:52:06 +00:00
return gracefulExit(0)
}
try {
await main()
} catch (err) {
console.error('unexpected error', err)
gracefulExit(1)
}