Recover from API change

This commit is contained in:
Gabriel Ostrolucký 2017-06-24 20:05:27 +02:00
parent 11fb849458
commit 87c794bb70
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,7 @@
Simple Subreddit Image Downloader
==========================
Tired of all of those reddit downloaders which want you to install tons of dependencies and then don't work anyway? Me too.
*Simple Subreddit Image Downloader* is bash script which:
- has minimal external dependencies
- downloads full-size images from subreddits

View File

@ -9,13 +9,12 @@ url="https://www.reddit.com/r/$subreddit/.json"
content=`wget -U "$useragent" --no-check-certificate -q -O - $url`
mkdir -p $output
while : ; do
urls=$(echo -e "$content"|grep -Po '"url":.*?[^\\]",'|cut -f 4 -d '"')
urls=$(echo -e "$content"|grep -Po '"source": {"url":.*?[^\\]",'|cut -f 6 -d '"')
names=$(echo -e "$content"|grep -Po '"title":.*?[^\\]",'|cut -f 4 -d '"')
ids=$(echo -e "$content"|grep -Po '"id":.*?[^\\]",'|cut -f 4 -d '"')
a=1
for url in $(echo -e "$urls"); do
if [ -n "`echo "$url"|egrep \".gif|.jpg\"`" ]; then
#echo -n "$url: "
name=`echo -e "$names"|sed -n "$a"p`
id=`echo -e "$ids"|sed -n "$a"p`
echo $name