Hacker News new | ask | show | jobs
Show HN: Plain Text Cryptocurrency Prices (plaintextco.in)
63 points by guillaumec 1467 days ago
17 comments

I get randomly HTML and ASCII in the terminal, otherwise cool product.

It would be nice to configure a list of coins to be displayed. Something like:

    https://plaintextco.in/collection/btc+tezos+near
Also, you could reduce the HTML size significantly by using <i> instead of <span> and create a classnames for the colors.
Yes, since I got too many requests from HN, I had to enable the CDN. I didn't realize it would cache both html and terminal request together. I tried setting "Vary: User-Agent" but it didn't work. You can add: "?term=true" to make it work in terminal for now.
I think Vary: Accept-Encoding or similar is the solution for this but not sure
looks like OP implemented it ( https://plaintextco.in/about ) :

   https://plaintextco.in/?ids=bitcoin,ethereum,mina-protocol,avalanche-2
oh cool, it's now ready for bookmarking :)
This is awesome! I will be able to check the prices without spinning up my old laptop's fan.

My preference for time is much longer-term. Trading too often can lead to ruin due to transaction fees (and/or emotion).

I'd use the 1 day, 30 day, and 365 day price changes instead of 1h, 24h, 7d.

Another small issue: I can't use autoscroll in Firefox because the whole page width is a link.

Some small feedback if I may: Could you separate the link and the text on the main page? My first thought was: "This isn't text. I can't highlight or copy anything. It's actually the opposite of what the title says." But everything was as advertised when viewing an actual coin.

Cool site! Cheers!

You are probably right. I should also probably add a link to a 'true' plain text version that returns a pure txt.
Pretty cool, I noticed it works both in the browser and command line. I suppose you are using the User-Agent header to detect which version to serve? Which library did you use for the interface?
It's all done by hand in go. Yes it uses the user agent to guess if the request comes from a terminal.
HN hug of death, I assume.
I assumed the prices were 0, hence the empty webpage.
That's awesome.

Some things that can be improved:

- The UI is left justified on my mobile browser. It will look better if it is centered.

- The font is too small. Perhaps you could increase font size so users don't have to zoom in.

Also, did you a framework to generate plaintext front-end or is it hand crafted?

Thanks for the comment! I wanted to keep the html and css as simple as possible so I didn't put much layout. If it gets traction I will improve that. Same thing for the font.

It's all hand crafted. My first time using golang so the code is probably not as efficient as it could be.

Really? It even renders ascii and colors properly in a terminal with curl !!!

\xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\n

Firefox 101.0.1 on Windows didn't seem to render it correctly. I was going to compare it to chrome but then the server died. Very cool page though.

Update: the server is back up and it looks fine on Firefox now. false alarm

All I see is a white page.
Same here. Hug of death.
Is this white page some sort of satire or is it down?
It's down ATM. I found a Wayback Machine snapshot for proof.

https://web.archive.org/web/20220614131126/https://plaintext...

Interesting. I wasn't aware that you could use a Cloudflare IP address along with a different name server.
Maybe they're using something like an ALIAS record instead of a CNAME setup?
Cloudflare Worker perhaps
Oh. From the headline I was hoping for something easily parseable.
I got a blank page...did crypto prices drop that much today?
This is really nice. Great work.
Getting a 504 :(
An intriguing failure mode (response body seems truncated)

  $ curl -i https://plaintextco.in/
  HTTP/2 504 
  date: Tue, 14 Jun 2022 14:13:44 GMT
  [more headers]
  cf-ray: 71b3ab17fc7254d5-MAN
  
        <!DOCTYPE htm
I think the server code has a concurrent access bug that makes it crash in the middle of a request. Unfortunately due to the current charge I can't even restart it at the moment.
Back online for now... please be gentle ;)
Got this just now (2022-06-14T22:36:26+08:00)
Yeah the server is not handling the load at the moment... I am trying to restart it.
The curse of Hacker News attention
Well, I should have tested a bit more before posting.
Is the source posted somewhere? Maybe we can help
Not at the moment, this was a week end project, and the code is quite horrible. But yes I should probably put it online and get advise.
Here is an extract of what happens in terminal :

curl https://plaintextco.in/coins/bitcoin

<!DOCTYPE html> <title></title> <meta name="description" content="Plain text cryptocurrency prices"> <style> @font-face { font-family: 'dejavu-sans-mono'; src: url('/static/DejaVuSansMono.ttf') format('truetype'); } * { font-family: 'dejavu-sans-mono'; font-size: small; line-height: 120%; } </style>

<h1>plaintextco.in</h1>

<h1></h1>

<pre> Bitcoin (BTC)

     <span style="color: #f7931a;"></span><span style="color: #f7931a;"></span><span style="color: #fe971a;background-color: #f7931a;"></span><span style="color: #fe971a;background-color: #f7931a;"></span><span style="color: #fc961a;background-color: #f7931a;"></span><span style="color: #fc961a;background-color: #f7931a;"></span><span style="color: #fd971a;background-color: #f7931a;"></span><span style="color: #ff971a;background-color: #f7931a;"></span><span style="color: #f7931a;"></span><span style="color: #f7931a;"></span>      Price                    $22,183
  <span style="color: #f7931a;"></span><span style="color: #f7931a;background-color: #f7931a;"></span><span style="color: #fd971a;background-color: #f7931a;"></span><span style="color: #f7931a;background-color: #ff9a1b;"></span><span style="color: #f79319;background-color: #fa941a;"></span><span style="color: #f79217;background-color: #f7931a;"></span><span style="color: #f79116;background-color: #f7931a;"></span><span style="color: #f9a239;background-color: #f79116;"></span><span style="color: #f9a53f;ba

It's impossible to read :(
Elinks in a terminal with 256 color + utf-8 renders it pretty decently.

https://imgur.com/a/NPsN5N5

Actually it also supports a black and white mode using only utf8 characters. I haven't exposed it yet though.
Lynx looks great.
This is what I get when trying it on any terminal on Windows.
I got something readable on Windows by calling it from the "Git bash" terminal (installs with git)
Plaintext and ascii art are in this year and that’s cool to me. Nice work.