mirror of
https://github.com/iv-org/youtube-utils.git
synced 2024-10-01 03:45:35 -04:00
api-helper: Don't use echo to redirect command output
This commit is contained in:
parent
86f9ce3742
commit
0fce8c7b16
@ -504,17 +504,18 @@ hdr_ua="User-Agent: ${user_agent}"
|
||||
|
||||
|
||||
# Run!
|
||||
result=$(
|
||||
curl --compressed -H "$hdr_ct" -H "$hdr_ua" --data "$data" "$url" | \
|
||||
sed -E '
|
||||
/^\s+"(clickT|t)rackingParams.+,$/d
|
||||
s/,?\n\s+"(clickT|t)rackingParams.+$//
|
||||
'
|
||||
)
|
||||
temp_dl=_curl_$(date '+%s')
|
||||
|
||||
# Default to STDOUT if no output file was given
|
||||
curl --compressed -H "$hdr_ct" -H "$hdr_ua" --data "$data" "$url" | \
|
||||
sed -E '
|
||||
/^\s+"(clickT|t)rackingParams.+,$/d
|
||||
s/,?\n\s+"(clickT|t)rackingParams.+$//
|
||||
' > "$temp_dl"
|
||||
|
||||
# Print to STDOUT if no output file was given
|
||||
if [ -z "$output" ]; then
|
||||
echo "$result"
|
||||
cat "$temp_dl"
|
||||
rm "$temp_dl"
|
||||
else
|
||||
echo "$result" > "$output"
|
||||
mv -- "$temp_dl" "$output"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user