Please note the repository has been moved from mooleshacat/invidious-token-updater to catspeed-cc/invidious-token-updater.
You can update your local clone with git remote set-url origin https://github.com/catspeed-cc/invidious-token-updater
I cannot figure out a good way to incorporate all of the repositories, or explain how to install them separately. The project is a mess, however if anyone figures it out and can use it then that is ok :) I may make minor changes for my own use, but there are no plans to make it ready for others to use.
This script is to automatically update the visitordata and po-token for Invidious instance.
This script was written for a manually installed instance of Invidious under the user account "invidious". Invidious executable must already be compiled, and service already started. The script will modify the configuration file and restart the service.
The user 'invidious' must have sudo access without password in order to restart the service, otherwise the script will ask for password. This is OK if you plan to run the script manually, but for crontab to automate it hourly, it will not work with a password.
docker and docker-compose is required as the script runs code from google inside the docker container to get the tokens
Now and then, YT will show a blank page to you and ask to perform a search in order for the algo to show you videos. This is a load of BS, YT is just testing to see if you are a bot or human. I've added a curl command to automagically perform a search query randomized from searches.txt. This will be done on every execution of the script (basically whenever you set up the cron job for, ex. every 3 hours)
You may add your own searches, one per line, so that there are more searches - too many for YT to ban. The chances of them starting to ban these specific searches is likely non-existant, as this would make the platform un-usable - eventually all searches possible would be banned. Using a more common search term is preferable, as banning it would also ban legitimate searches for the same term.
If YT shows you cat videos, don't ask questions :3c
The tokens only need updating once per 24-48 hours, however I think it is better to do it every 3 hours to change the tokens regularily to try and stay as anonymous as possible.
It is no longer required that the script resides inside the invidious directory.
The script no longer replaces the invidious configuration file, it will edit the specific configuration lines directly inside ~invidious/invidious/config/config.yml
.
The script is NOT production ready without extensive changes to the way the tokens are updated, etc.
Below assumes the following:
USER - invidious
INVIDIOUS INSTALL LOCATION - ~invidious/invidious/
INV_SIG_HELPER INSTALL LOCATION - ~invidious/inv_sig_helper/
INVIDIOUS TOKEN UPDATER INSTALL LOCATION - ~invidious/invidious-token-updater/
SCRIPT LOCATION - ~invidious/invidious-token-updater/update-tokens.sh
- Create user invidious (as root)
useradd -m invidious
- Add user to /etc/sudoers (as root)
nano /etc/sudoers
add ininvidious ALL=(ALL:ALL)NOPASSWD:ALL
- Add user to docker group (as root)
usermod -aG docker invidious
- Switch to invidious user
su - invidious
if not already - Make sure you are in home directory
cd ~
- Clone inv_sig_helper repository
git clone https://github.com/iv-org/inv_sig_helper.git
- Change directory
cd inv_sig_helper
- Build the docker image
docker build -t inv_sig_helper .
- this may take a while. - Run the docker container
sudo docker run --restart unless-stopped --network host --name inv_sig_helper -p 127.0.0.1:12999:12999 inv_sig_helper
- Switch to invidious user
su - invidious
if not already - Make sure you are in home directory
cd ~
- Clone invidious repository
git clone https://github.com/iv-org/invidious.git
- Change directory
cd invidious
(follow invidious manual compile/install instructions) - Copy
~invidious/invidious/config/config.example.yml
toconfig/config.yml
- Edit
~invidious/invidious/config/config.yml
to your liking- change hmac_key to anything random
- update mongodb settings (should be localhost, verify user/pass are correct)
- update signature_server line to your inv_sig_helper LAN IP(should be localhost, verify port is correct)
- Switch to invidious user
su - invidious
if not already - Make sure you are in home directory
cd ~
- Clone this repository
git clone https://github.com/mooleshacat/invidious-token-updater.git
- Change directory
cd invidious-token-updater
- Copy
config.cfg.example
toconfig.cfg
- Edit
config.cfg
to your liking (most defaults probably OK) - Test the script
~invidious/invidious/invidious-token-updater/update-tokens.sh
and checkconfig/config.yml
gets created with tokens on the bottom - Add a crontab to invidious user account (this one is every 3 hours)
crontab -e
add in00 */3 * * * ~invidious/invidious-token-updater/update-tokens.sh
This script makes use of several other repositories and/or docker images maintained by others. I do not have anything to do with their repos and they have nothing to do with this repo. These repositories / docker images should contain their original licenses as they are either used as a remote docker image, or a cloned repository as a whole. Please be aware of these separate licenses.
- Github (youtube-trusted-session-generator): https://github.com/iv-org/youtube-trusted-session-generator
- Github (inv_sig_helper): https://github.com/iv-org/inv_sig_helper
- Github (invidious): https://github.com/iv-org/invidious
This repository uses Unlicense, a copy of which can be found in LICENSE.md
Please be aware of the licenses of the other projects found at their respective githubs listed under "Dependencies".
As you can see from the installation instructions, you are cloning the code repositories directly yourself, and then configuring it yourself. While my code utilizes their code, their code is in no way included within my repository and you are still bound by their respective licenses.
If anyone wishes they can clone/fork this repository (invidious-token-updater) and modify it.