summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-04-07 23:56:25 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-04-07 23:56:25 +0530
commit906eea5b48f00ed698c8e4171c3d78a11e3e598b (patch)
tree91c318582acb7224f8c2be7e4c96f7efe6b41557
parent7405f5257a86c4e2da4e827194b2d325fd9440ef (diff)
.scripts: 4chget slight changes+double quotes
-rw-r--r--[-rwxr-xr-x].scripts/4chget21
1 files changed, 14 insertions, 7 deletions
diff --git a/.scripts/4chget b/.scripts/4chget
index 7084db9..1317824 100755..100644
--- a/.scripts/4chget
+++ b/.scripts/4chget
@@ -1,25 +1,32 @@
#!/bin/bash
+
rootpapesdir="$HOME/pix/wallpaper/4chget"
[ -d "$rootpapesdir" ] || mkdir "$rootpapesdir"
+
echo "Welcome to 4chan web/image scrapping script"
echo "Is it wallpaper/general (wg) or anime wallpaper (w)?"
read option
-#Validate user input
+
+# Validate user input
while [[ "$option" != "w" && "$option" != "wg" ]]; do
read -p "Please choose a valid option w or wg: " option
done
+
if [[ $option == "w" ]] ; then
parentdir="$rootpapesdir/w"
else
parentdir="$rootpapesdir/wg"
fi
+
echo "Enter folder name:"
read dir
-#Validate directory name
-while [[ -d "$parentdir"/"$dir" ]]; do
- read -rp "Directory already exists. Please enter a different name:" dir
+
+# Validate directory name
+while [[ -d "$parentdir/$dir" ]]; do
+ read -rp "Directory already exists. Please enter a different name: " dir
done
-mkdir -p "$rootpapesdir"/"$dir"
+
+mkdir -p "$parentdir/$dir"
echo "Directory '$dir' created successfully."
echo "Enter thread no.: (#######)"
@@ -27,10 +34,10 @@ read thread
case "$option" in
"wg")
- wget -P "$parentdir"/"$dir" -nd -r -l 1 -H -D i.4cdn.org,is2.4chan.org -A png,jpg,jpeg -R '*s.*' https://boards.4chan.org/wg/thread/"$thread" ;;
+ wget -P "$parentdir/$dir" -nd -r -l 1 -H -D i.4cdn.org,is2.4chan.org -A png,jpg,jpeg -R '*s.*' https://boards.4chan.org/wg/thread/"$thread" ;;
"w")
- wget -P "$parentdir"/"$dir" -nd -r -l 1 -H -D i.4cdn.org,is2.4chan.org -A png,jpg,jpeg -R '*s.*' https://boards.4channel.org/w/thread/"$thread" ;;
+ wget -P "$parentdir/$dir" -nd -r -l 1 -H -D i.4cdn.org,is2.4chan.org -A png,jpg,jpeg -R '*s.*' https://boards.4channel.org/w/thread/"$thread" ;;
esac
echo "Wallpapers downloaded successfully."