Created
September 10, 2024 19:09
-
-
Save stonerl/87e48afda3dfcc6c3a02a7b5fc039db1 to your computer and use it in GitHub Desktop.
refresh_token.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run the Docker command and capture its output | |
output=$(docker run quay.io/invidious/youtube-trusted-session-generator) | |
# Extract visitor_data and po_token using grep and awk | |
visitor_data=$(echo "$output" | grep "visitor_data:" | awk '{print $2}') | |
po_token=$(echo "$output" | grep "po_token:" | awk '{print $2}') | |
# Check if both values were extracted | |
if [[ -z "$visitor_data" || -z "$po_token" ]]; then | |
echo "Error: Could not extract visitor_data or po_token from the Docker output." | |
exit 1 | |
fi | |
# Update the docker-compose.yml file | |
compose_file="docker-compose.yml" | |
# Use sed to replace the existing values of visitor_data and po_token in the file | |
sed -i "s/visitor_data: .*/visitor_data: $visitor_data/" "$compose_file" | |
sed -i "s/po_token: .*/po_token: $po_token/" "$compose_file" | |
echo "Updated docker-compose.yml with new visitor_data and po_token." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment