mirror of
https://gitea.invidious.io/iv-org/youtube-utils.git
synced 2024-08-15 00:53:16 +00:00
api-helper: Don't use echo to redirect command output
This commit is contained in:
parent
86f9ce3742
commit
0fce8c7b16
1 changed files with 11 additions and 10 deletions
|
@ -504,17 +504,18 @@ hdr_ua="User-Agent: ${user_agent}"
|
||||||
|
|
||||||
|
|
||||||
# Run!
|
# Run!
|
||||||
result=$(
|
temp_dl=_curl_$(date '+%s')
|
||||||
curl --compressed -H "$hdr_ct" -H "$hdr_ua" --data "$data" "$url" | \
|
|
||||||
sed -E '
|
|
||||||
/^\s+"(clickT|t)rackingParams.+,$/d
|
|
||||||
s/,?\n\s+"(clickT|t)rackingParams.+$//
|
|
||||||
'
|
|
||||||
)
|
|
||||||
|
|
||||||
# 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
|
if [ -z "$output" ]; then
|
||||||
echo "$result"
|
cat "$temp_dl"
|
||||||
|
rm "$temp_dl"
|
||||||
else
|
else
|
||||||
echo "$result" > "$output"
|
mv -- "$temp_dl" "$output"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue