Shorten custom API command

hello there… Is there some way to short these commands, because I wanted to fit them both in 1. Better explaining:

This command shows the ISS speed in miles: $(eval try{a=JSON.parse($(urlfetch json https://api.wheretheiss.at/v1/satellites/25544?units=miles));b=a.units;ISS Vel: ${a.velocity.toFixed()} ${b} | Alt: ${a.altitude.toFixed()} ${b};}catch(e){})

And this one shows in Km: $(eval try {a=JSON.parse($(urlfetch json https://api.wheretheiss.at/v1/satellites/25544));b=a.units;ISS Vel: ${a.velocity.toFixed()} ${b}/hr | Alt: ${a.altitude.toFixed()} ${b};}catch(e){Err;})

I have been trying to short them but it shows up as “undefined”… I have shorten the links with “tinyurl” but is it possible to show miles AND km in 1 command? AND the command can only have 200 characthers because YouTube…
These are the links shorten:
for the miles/h -> https://tinyurl.com/yxas33wt
for the km/h -> https://tinyurl.com/q5mfymm

@C.A

$(eval z=`$(urlfetch json https://api.wheretheiss.at/v1/satellites/25544)`;$(urlfetch https://pastebin.com/raw/wAiY4DsB))
1 Like

Thank youuuu!!! You’re the best, Roketto!

Looks like kilometre is default, why not just convert it to miles yourself since I believe that is what the ?unit=miles query does for you when you request that page.

That’s exactly what I did. If you check out the command response I posted, it fetches JS code from https://pastebin.com/raw/wAiY4DsB that converts the altitude and velocity data from km to miles.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.