This site's inspiration, Hacker News, has had an API for ages:
Why doesn't Stacker News have one? Being able to read HN without a web browser is bliss, like Usenet in the old days. I'd much rather read Stacker News that way than HN, but you're not giving us a choice here...
I have to say that using LN to upvote posts is pretty addictive (I've been reading this site for about a month but this is my first time actually sending sats).
It's like flinging nickels at people. Disturbingly fun. You can do it to people who help you and to people who annoy you. Very strange.
reply
Why no account though with LNURL-auth?
You'll just be a random pubkey until you want to set your nym. This way, you'll receive any sats that you got zapped in your account.
Any sats that @anon got zapped ends up in the daily reward pool
reply
Electrum doesn't support lnurl-auth (as far as I can tell).
I'm seriously considering implementing it myself, because it looks like all the clients that do support it are either idiotphone apps or else bloated piles of electron.
I don't suppose there are any command-line lnurl-api clients? Maybe in rust? Okay I'm probably pushing my luck there.
reply
I'm seriously considering implementing it myself, because it looks like all the clients that do support it are either idiotphone apps or else bloated piles of electron.
If it helps, you could say I implemented the wallet/client part of LNURL-auth for tests here in Golang.
reply
You can use the api if you’re clever enough
reply
Yes but nobody's going to put serious effort into writing software for a bootleg reverse-engineered API that can be vanished at any time with no reputational consequences for the site.
Come on guys. Man up. Free the WOT!
reply
two people already started
Also, I just remembered that @elvismercury was playing around with the GraphQL playground here
Isn't this already like a public, documented API?
You can even use it from your browser, lol
So at least the argument that you have to reverse-engineer it no longer holds
reply
The whole point is to not need a browser.
reply
It's GraphQL. You don't need a browser. I said you can even use it from your browser.
The playground is there to make it easy to get into. To just play around initially.
If you want the GraphQL API schema in plaintext, it's here.
Now do some PoW or wait until we're ready :)
reply
Now do some PoW or wait until we're ready :)
Speaking of which, if you're really determined to use GraphQL as your API, please be ready to charge a few sats per API call. Because if not some moronic idiot is going to think it's funny to flood the site with compute-expensive calls.
Every site I know of that exposes a GraphQL API is eventually forced to either (a) put users through CAPTCHA-hell (b) do browser fingerprinting, usually via cloudflare, (c) some kind of real-world identity linkage like SMS verification, or (d) some combination of the above.
I would hate to see that happen to SN.
I probably can't convince you that exposing GraphQL to anonymous callers is a bad idea, so hopefully I can convince you to be ready with something less awful than (a)(b)(c)(d) when the inevitable result occurs.
Thanks again for creating this awesome site.
reply
Speaking of which, if you're really determined to use GraphQL as your API, please be ready to charge a few sats per API call. Because if not some moronic idiot is going to think it's funny to flood the site with compute-expensive calls.
we've considered it. we're going to do it when it's needed :)
so enjoy the free ride as long as it's possible :)
I probably can't convince you that exposing GraphQL to anonymous callers is a bad idea, so hopefully I can convince you to be ready with something less awful than (a)(b)(c)(d) when the inevitable result occurs.
no, you can, you actually don't even have to because i already somewhat agree :)
we're aware that GraphQL is vulnerable to n+1 queries and some malicious actor ... not going to continue for hopefully obvious reasons :)
reply
You don't need a browser
I sure looks like you do:
SN_AUTH_COOKIE must be set with a valid session cookie.
Some functions need authentication. Right now this is handled by pasting you session cookie into a .env file under SN_AUTH_COOKIE. How to Retrieve a Cookie from a Web Request: Open Developer Tools ...
reply
yes yes, you are right, i forgot about this :)
i think i am using ":)" so much it might actually start looking like i mean it in a "sarcastic way", lol
reply
bootleg reverse-engineered API that can be vanished at any time with no reputational consequences for the site.
I think you just answered your own question:
Why doesn't Stacker News have one?
reply
This, lol
This site has no documented public API because... I'm sure you'll be able to guess :)
Or should I say no API that is documented in the form one might expect when they hear "documented API" :)
reply
k00b must have given you a raise, you’re throwing around sats like they’re fiat lol
reply
👀👀👀
I'll let this be my reply :)
reply
I'm sure you'll be able to guess
Actually i'm not. I guess I'm dumb. But I've suspected that for a long time.
I think I'll just go mope now and be depressed and shove jalepeno peppers under my fingernails.
(oh yeah, and find a lnurl-auth client)
reply
That is a weird way of coping but I'm strangely drawn to it...
reply
The GraphQL playground might actually already be all that you want :)
I hope you haven't already closed this site and will never read this now lol ...
reply
Being able to read HN without a web browser
SN_AUTH_COOKIE must be set with a valid session cookie.
How do I obtain an SN_AUTH_COOKIE without a browser again?
reply
31.3k sats \ 2 replies \ @ek 8 Dec 2023
Okay, fair point :)
This we can maybe do sooner than later :)
But you only have to get it once and then refresh using a specific endpoint.
But yes, with API keys, it's going to be way easier.
I am having this problem with my own bots @hn and @unpaywall.
I'll create a ticket now :) -> here it is

but if I want to be pedantic: I think I'd be able to get an SN_AUTH_COOKIE only with curl ... but as I said, I agree. You have a point there :)
We can make a small bet if you want. I'll bet 5k sats that I can do it, lol.
reply
oh dude lame i zapped you 31337 sats and it displays as "31.3k". :poop-emoji:
reply
wow, thanks, but for what exactly?
and don't worry, i can see the exact amount in my notifications :)
You and your edits lol
reply
When did I... Ohh, right, hahaha, I forgot!
Must. Tell. Everyone. What. I. Think. In. Real. Time.
^ these weren't edits
reply
reply
reply
Why doesn't Stacker News have one?
@anon, I dare you to guess!
reply