Improve waifu-gen - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
DIR commit 05282de1d132adfe199e95f3acac6a8d08143948
DIR parent 83efd3bdebd000e52fc7a5ac3b4d205b6ac8ab9a
HTML Author: srfsh <m@srf.sh>
Date: Mon, 28 Mar 2022 14:26:20 +0300
Improve waifu-gen
Signed-off-by: Annna Robert-Houdin <annna@bitreich.org>
Diffstat:
M waifu-gen | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
---
DIR 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"