Last active
March 9, 2023 22:50
-
-
Save MarkTiedemann/d90bfd8134bb13695137f46f248db22e to your computer and use it in GitHub Desktop.
Direct Strike Leaderboard API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
if not exist %~dp0timeit.exe ( | |
curl -Lo %~dp0timeit.exe https://github.com/MarkTiedemann/rktools2k3/raw/master/timeit.exe | |
) | |
if not exist %~dp0jq.exe ( | |
curl -Lo %~dp0jq.exe https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe | |
) | |
echo. | |
for /f "tokens=2,6,8,14 delims=:,}" %%a in ('%~dp0timeit.exe curl "https://api.wc3stats.com/leaderboard?map=Direct%%20Strike%%20Reforged&season=Season%%204&search=%1" 2^> nul ^| %~dp0jq -c ".body[]"') do ( | |
set "name=%%a" | |
set "name=!name:~1,-1!" | |
for /f "tokens=1 delims=#" %%n in ("!name!") do ( | |
echo #%%d %%n %%b / %%c | |
) | |
) | |
echo. | |
for /f "skip=2 tokens=3" %%t in ('%~dp0timeit.exe -t 2^>^&1') do ( | |
set "time=%%t" | |
for /f "tokens=3 delims=:" %%s in ("!time!") do ( | |
set "seconds=%%s" | |
set "seconds=!seconds:~1,-2!" | |
echo in !seconds!s | |
) | |
) | |
del timeit.dat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment