Hacker News API examples & templates
Use these vals as a playground to view and fork Hacker News API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.

stevekrouse
blueskySearchPostsDemo
app.bsky.feed.searchPosts API Docs: https://docs.bsky.app/docs/api/app-bsky-feed-search-posts Example Response XRPCResponse {
data: {
posts: [
{
uri: "at://did:plc:uqtqvy3ydp2pcqbgr2yjppcj/app.bsky.feed.post/3lbsfypbbdk26",
cid: "bafyreiesbymbxclbatvh3slqmmrbazkupng4kcwn5tojnojvvrb3pzock4",
author: {
did: "did:plc:uqtqvy3ydp2pcqbgr2yjppcj",
handle: "kyrre.dev",
displayName: "Kyrre",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:uqtqvy3ydp2pcqbgr2yjppcj/bafkreiadk656yzrvkpgr5avgcab6ftmptig4slqyn3hturou3eaox5o24i@jpeg",
labels: [],
createdAt: "2023-11-26T00:05:04.154Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T20:58:07.518Z",
facets: [Array],
langs: [Array],
reply: [Object],
text: "Cool, @val.town is awesome!"
},
replyCount: 0,
repostCount: 0,
likeCount: 2,
quoteCount: 0,
indexedAt: "2024-11-25T20:58:07.955Z",
labels: []
},
{
uri: "at://did:plc:4op2gckllrrttktwi4vg2j2p/app.bsky.feed.post/3lbs6qjce6k2c",
cid: "bafyreicx6nivr22zdpuxvnihfk3ifk3d6y37ug5e32tqzkcefmwnxsqt6a",
author: {
did: "did:plc:4op2gckllrrttktwi4vg2j2p",
handle: "gksh.dev",
displayName: "Gustavo Karkow",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:4op2gckllrrttktwi4vg2j2p/bafkreib5m52xjyidrsnfvyxoie7zwpusus6wzacr4k2tpobue5o7ysr3o4@jpeg",
associated: [Object],
labels: [],
createdAt: "2023-07-28T21:31:46.738Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T18:48:16.611Z",
embed: [Object],
facets: [Array],
langs: [Array],
text: "@stevekrouse.com can't tell what happened, but I was using Townie for a thing and it inverted the reasoning and code outputs for whatever reason."
},
embed: { "$type": "app.bsky.embed.images#view", images: [Array] },
replyCount: 1,
repostCount: 0,
likeCount: 1,
quoteCount: 0,
indexedAt: "2024-11-25T18:48:19.130Z",
labels: []
},
{
uri: "at://did:plc:hkutgcisjksjzjl7j2xwjbsw/app.bsky.feed.post/3lbrrmgknxs2f",
cid: "bafyreiesuxytdmwqb27tw32r6hrmcvq6up7xffs27mxmayfjph3yvsehmi",
author: {
did: "did:plc:hkutgcisjksjzjl7j2xwjbsw",
handle: "bezbac.me",
displayName: "Ben Bachem",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:hkutgcisjksjzjl7j2xwjbsw/bafkreienzxwrlwwocthenmzs57xptthtvahgjbh7k4qg47mvpvx2lapdfu@jpeg",
associated: [Object],
labels: [],
createdAt: "2023-08-29T19:30:57.132Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T14:53:20.897Z",
facets: [Array],
langs: [Array],
reply: [Object],
text: "Congrats! I’m always impressed by product and team at @val.town"
},
replyCount: 0,
repostCount: 0,
likeCount: 2,
quoteCount: 0,
indexedAt: "2024-11-25T14:53:21.757Z",
labels: []
},
{
uri: "at://did:plc:zxkg5d6y6uhrsoctq7wgwqul/app.bsky.feed.post/3lbrrjwuz422q",
cid: "bafyreic7m5lf4ta5az2hwcaa7hzka6dawadsohiqxyikmeb7ql4k3q3bwq",
author: {
did: "did:plc:zxkg5d6y6uhrsoctq7wgwqul",
handle: "just-be.dev",
displayName: "Justin",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:zxkg5d6y6uhrsoctq7wgwqul/bafkreidbly6rg5tzb3pnlizsxevgd3nvu42ko4r6igetudvwvp2qnbx2fa@jpeg",
labels: [],
createdAt: "2023-04-24T14:47:37.014Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T14:51:57.352Z",
facets: [Array],
langs: [Array],
text: "Hey friends! Big news. I'm working at @val.town now!"
},
replyCount: 16,
repostCount: 4,
likeCount: 72,
quoteCount: 0,
indexedAt: "2024-11-25T14:51:57.665Z",
labels: []
},
{
uri: "at://did:plc:jfbrs3p2mytb4qh4kgzdnild/app.bsky.feed.post/3lbprmrkbo22q",
cid: "bafyreieoufjenhjflt2n4lr6k45wys7j3f6nfehs5ndkbs6g2ng2cw7al4",
author: {
did: "did:plc:jfbrs3p2mytb4qh4kgzdnild",
handle: "daniel-levine.bsky.social",
displayName: "Dan Levine",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:jfbrs3p2mytb4qh4kgzdnild/bafkreibjeo2eqdinlrfm6xa2mprnyyaryb3gaajrmhslx5bq2o3xx2ftby@jpeg",
labels: [],
createdAt: "2024-11-04T19:07:59.180Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-24T19:48:12.943Z",
embed: [Object],
facets: [Array],
langs: [Array],
reply: [Object],
text: "💯 I want to see a ton of Val.town apps that make use of Bluesky :) cc @stevekrouse.com"
},
embed: { "$type": "app.bsky.embed.external#view", external: [Object] },
replyCount: 1,
repostCount: 0,
likeCount: 1,
quoteCount: 0,
indexedAt: "2024-11-24T19:48:16.162Z",
labels: []
}
]
},
headers: {
"access-control-allow-origin": "*",
"atproto-content-labelers": "did:plc:ar7c4by46qjdydhdevvrndac;redact",
"cache-control": "public, max-age=30",
"cdn-cache": "MISS",
"cdn-cachedat": "11/25/2024 21:38:59",
"cdn-edgestorageid": "894",
"cdn-proxyver": "1.06",
"cdn-pullzone": "1816608",
"cdn-requestcountrycode": "US",
"cdn-requestid": "a5715b0e4a5fa58d0ce748a59a8a66aa",
"cdn-requestpullcode": "200",
"cdn-requestpullsuccess": "True",
"cdn-requesttime": "0",
"cdn-status": "200",
"cdn-uid": "57ad37ea-0c96-40cb-9722-d1abe3b3ecd9",
"content-type": "application/json; charset=utf-8",
date: "Mon, 25 Nov 2024 21:38:59 GMT",
server: "BunnyCDN-IL1-1206",
"strict-transport-security": "max-age=63072000",
vary: "Accept-Encoding",
"x-powered-by": "Express"
},
success: true
}
Script
willthereader
ChatGPTTextDefinitionUserscript
// @name Improved ChatGPT Text Definition with Follow-up Questions
Script

petermillspaugh
dailySubscriptionStats
Val Town email subscriptions: daily stats Cousin Val to @petermillspaugh/emailSubscription for emailing yourself daily subscriber stats.
Cron
alexwein
loopyLetters
[WIP] Loopy Letters, another little word game A word game with a small gameplay loop. Plays best on your phone. It uses random words from the Wordnik word game list, as shared on their Github page ,
which has a lot of stuff on there I myself wouldn't really consider a word. Sorry about that. I probably spent as much time prompting the Townie LLM interface as I did in the code editor.
So if parts seem sloppy, it's because it is slop. Rules Use every letter on the donut to spell a word. Letters in the word must be adjacent to each other on the donut. You can go clockwise or counterclockwise . When you find a word. The next word to find appears. Go fast. Go slow. Enjoy. This revisits the gameplay from a 2002 Observable notebook I made called
"find a (big) word, rings" .
HTTP