From a03b71fd0ca338372854e8978235e681bf0d8da7 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Fri, 27 Aug 2021 07:01:00 +0000 Subject: [PATCH] output subreddit to data.txt --- reddit-wallpaper-fetcher | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/reddit-wallpaper-fetcher b/reddit-wallpaper-fetcher index ee62a28..82108de 100755 --- a/reddit-wallpaper-fetcher +++ b/reddit-wallpaper-fetcher @@ -41,6 +41,9 @@ for i in "${SUBREDDITS[@]}"; do temp=$(curl "$LOUD" --user-agent "$USER" "https://www.reddit.com/r/$i.json?sort=$SORT&limit=1") time=$(echo "$temp" | jq -r ".data.children[-1].data.created_utc") + if [ "$time" == "null" ]; then + continue + fi if [ $(awk -v n1="$time" -v n2="$LATEST_TIME" 'BEGIN {printf (n1>n2?"1":"")}') ]; then LATEST="$temp" LATEST_TIME="$time" @@ -65,6 +68,7 @@ echo "$LATEST" > "$WALLDIR"/json title=$(echo "$LATEST" | jq -r ".data.children[-1].data.title") echo "$title" > "$WALLDIR"/data.txt +echo $LATEST | jq -r ".data.children[-1].data.subreddit" >> "$WALLDIR"/data.txt echo "$url" >> "$WALLDIR"/data.txt echo https://reddit.com$(echo "$LATEST" | jq -r ".data.children[-1].data.permalink" | sed 's/"//g') >> "$WALLDIR"/data.txt -- Gitblit v1.10.0