Improve waifu-gen - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 05282de1d132adfe199e95f3acac6a8d08143948 | |
parent 83efd3bdebd000e52fc7a5ac3b4d205b6ac8ab9a | |
Author: srfsh <[email protected]> | |
Date: Mon, 28 Mar 2022 14:26:20 +0300 | |
Improve waifu-gen | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M waifu-gen | 17 +++++++++-------- | |
1 file changed, 9 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/waifu-gen b/waifu-gen | |
@@ -1,15 +1,16 @@ | |
#!/bin/sh | |
-totalimages="$(hurl https://www.thiswaifudoesnotexist.net/ \ | |
+page=$(hurl https://www.thiswaifudoesnotexist.net/) | |
+totalimages=$(printf "%s\n" "$page" \ | |
| grep "var totalImages" \ | |
- | sed 's,.*= \([^;]*\);,\1,')" | |
-totaltexts="$(hurl https://www.thiswaifudoesnotexist.net/ \ | |
+ | sed 's,.*= \([^;]*\);,\1,') | |
+totaltexts=$(printf "%s\n" "$page" \ | |
| grep "var totalTexts" \ | |
- | sed 's,.*= \([^;]*\);,\1,')" | |
+ | sed 's,.*= \([^;]*\);,\1,') | |
-randimg="$(shuf -i 1-${totalimages} -n 1)" | |
-randtext="$(shuf -i 1-${totaltexts} -n 1)" | |
+randimg=$(shuf -i 1-"$totalimages" -n 1) | |
+randtext=$(shuf -i 1-"$totaltexts" -n 1) | |
-printf "https://www.thiswaifudoesnotexist.net/example-%s.jpg " "${randimg}" | |
-printf "https://www.thiswaifudoesnotexist.net/snippet-%s.txt\n" "${randtext}" | |
+printf "https://www.thiswaifudoesnotexist.net/example-%s.jpg " "$randimg" | |
+printf "https://www.thiswaifudoesnotexist.net/snippet-%s.txt\n" "$randtext" | |