Update rid

Changed wget to curl
Added useragent
This commit is contained in:
mirror-maker 2023-12-09 00:23:49 -05:00
parent f1b7bb1e07
commit 42dd8a93c8
1 changed files with 68 additions and 64 deletions

10
rid
View File

@ -1,7 +1,10 @@
#!/bin/bash #!/bin/bash
# #https://github.com/dbeley/rid/blob/master/rid
# rid - Reddit Image Downloader - Simple bash script to download images from a subreddit. # rid - Reddit Image Downloader - Simple bash script to download images from a subreddit.
useragent="Love by u/gadelat"
timeout=60 timeout=60
usage() { printf "%s" "\ usage() { printf "%s" "\
@ -32,8 +35,9 @@ if [ -z $number ]; then
number=200 number=200
fi fi
url="https://www.reddit.com/r/$subreddit/$sort/.json?raw_json=1&t=$top_time" url="https://www.reddit.com/r/$subreddit/$sort/.json?raw_json=1&t=$top_time"
content=$(wget -T $timeout -q -O - $url) content=`curl -H "User-Agent: $useragent" $url`
mkdir -p $subreddit mkdir -p $subreddit
i=1 i=1
while : ; do while : ; do
@ -60,5 +64,5 @@ while : ; do
break break
fi fi
url="https://www.reddit.com/r/$subreddit/$sort/.json?count=200&after=$after&raw_json=1&t=$top_time" url="https://www.reddit.com/r/$subreddit/$sort/.json?count=200&after=$after&raw_json=1&t=$top_time"
content=`wget -T $timeout --no-check-certificate -q -O - $url` content=`curl -H "User-Agent: $useragent" $url`
done done