The objective: download the videos being streamed from any website (not just youtube).
To do that, Python could monitor the network traffic, isolate the video stream, and then write that stream to a file.
I have two questions:
The objective is to download videos being streamed from any website.
Ok, so first thing is there are many different ways video is streamed over the internet. Some sites use Http Live Streaming, some use RTMP, multicast UDP, etc.. so your application is going to need to be versitile in handling different streaming protocols.
Python could monitor the network traffic. Perhaps tcpdump could be called from python and you could listen on a specific interface which the video traffic is flowing.
Then after you save the capture parse the capture file for specific types of packets. You will need to research how to assemble the packets from the capture to recreate the video stream.
I would pick one website and see if you can automate the downloading of the video and then once that is working pick other sites which use different streaming protocols and add that functionality to your application one at a time.