when I enter the youtube URL in my browser I want the URL to automatically change and visit a different website (invidio.us). Can someone provide any pointers as to how to achieve this with Python?
I don't think you can solve this in python. You will need a browser plugin for this one, and the add-ons aren't written in python.
Try JavaScript.
replacing an url in a browser automatically with python