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! | ||||
| 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…
	
	Add table
		Add a link
		
	
		Reference in a new issue