examples/ytfeed.dl: toss 404s
This commit is contained in:
@@ -13,9 +13,12 @@ while test -n "$2"; do
|
|||||||
else curl=false
|
else curl=false
|
||||||
fi
|
fi
|
||||||
filename="$(printf '%s/%s.xml\n' "$directory" "$2")"
|
filename="$(printf '%s/%s.xml\n' "$directory" "$2")"
|
||||||
$curl "$xml_url_prefix""$2" >"$filename".new \
|
$curl "$xml_url_prefix""$2" >"$filename".new
|
||||||
&& mv "$filename".new "$filename" \
|
if ! grep '<title>' <"$filename".new | head -n 1 \
|
||||||
&& printf '%s\n' "$filename" \
|
| grep 404 >/dev/null 2>&1
|
||||||
|| rm -f "$filename".new
|
then mv "$filename".new "$filename" \
|
||||||
|
&& printf '%s\n' "$filename"
|
||||||
|
fi
|
||||||
|
rm -f "$filename".new
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user