iv-org / documentation

The official Invidious documentation
https://docs.invidious.io
Creative Commons Zero v1.0 Universal
599 stars 155 forks source link

Guide for configuring sig_helper + potoken #580

Closed unixfox closed 1 month ago

unixfox commented 2 months ago

Write a guide with:

manfromdownunder commented 2 months ago

Not sure if this is helpful for this issue. I have created a script that updates the tokens in the docker-compose. Set the cron to run it as often as needed. I am using refresher with 6 instances so there are other cron jobs restarting the instances hourly. If you are running a single instance un comment the docker-restart in the script below.

#!/bin/bash

# Run the Docker container and capture the output
output=$(docker run quay.io/invidious/youtube-trusted-session-generator)

# Extract visitor_data and po_token from the output
visitor_data=$(echo "$output" | grep -oP '(?<=visitor_data: ).*')
po_token=$(echo "$output" | grep -oP '(?<=po_token: ).*')

# Define the path to your docker-compose file
compose_file="/opt/invidious/docker-compose.yml"

# Update the docker-compose.yml file with the new visitor_data and po_token
sed -i "s/visitor_data: .*/visitor_data: $visitor_data/" $compose_file
sed -i "s/po_token: .*/po_token: $po_token/" $compose_file

# Restart the Docker containers
#docker-compose -f $compose_file down
#docker-compose -f $compose_file up -d