Https://forum.brettterpstra.com/c/site-feedback/2

Hey Brett, first time long time… :yum:

I was wondering if you knew of a way to add Hipster Ipsum to TextExpander?
https://hipsum.co/

They have an API for stuff like this, but I have no idea what I’m doing in there…

thx!

:frowning: The API has “moved”… and is no longer responding. Darn.

1 Like

I get a response from https://hipsum.co/api/?type=hipster-centric&sentences=3 . The docs offer an HTTP address, so curling that would need a -L flag, but just changing it to HTTPS resolves properly.

Adding it to TextExpander requires a shell script to do the http request. I’ve switched to using Text Blaze for this kind of thing, they offer a {urlload} command that will ping a JSON API and parse the response (takes a little fiddling, but it works).

If you want to do it in TextExpander, though, I have a couple of Lipsum snippets that use JSON APIs that you could dissect. See this group, which has a base snippet called includerubylipsum that has the code for curling the url, and a series of snippets that include that snippet with various parameters. Note that none of those snippets currently work as they reference a dead API, but it would give you an example of how to do it.

1 Like

To do this in Text Blaze:

{note} {formmenu: sentences; default=paras; name=type} {formtext: name=qty; cols=3; default=3} {endnote}

{urlload: https://hipsum.co/api/?type=hipster-centric&{=type}={=qty}; done=(res) -> [ "payload": res ]; method=GET} {result=join(payload, "\n\n")} {=result}

Example output:

Thundercats biodiesel drinking vinegar typewriter flannel vice gorpcore vinyl, yes plz church-key cornhole skateboard. Bodega boys thundercats succulents tote bag organic. Ennui kogi adaptogen PBR&B green juice hashtag solarpunk.

:smile:

1 Like

Confused Always Sunny GIF by It's Always Sunny in Philadelphia