Fix #8: jq: error: null (null) cannot be matched, as it is not a string

This commit is contained in:
Gabriel Ostrolucký 2020-01-21 20:37:08 +01:00
parent 0046879d08
commit 885219acd1
No known key found for this signature in database
GPG Key ID: 0B618B95BA22CEEF
1 changed files with 3 additions and 3 deletions

View File

@ -20,9 +20,9 @@ url="https://www.reddit.com/r/$subreddit/$sort/.json?raw_json=1&t=$top_time"
content=`wget -T $timeout -U "$useragent" -q -O - $url`
mkdir -p $subreddit
while : ; do
urls=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")) | .data.preview.images[0].source.url')
names=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")) | .data.title')
ids=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")) | .data.id')
urls=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.preview.images[0].source.url')
names=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.title')
ids=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.id')
a=1
wait # prevent spawning too many processes
for url in $urls; do