Question about AV Streams in the internet

Hi. I have one task which now I cannot do:
I need to find some chunks of code for catching Audio-Video Stream in the internet when a user watch some video in the internet.
Which chunks of codes can help me to solve this problem?

If your intention is to capture and download video streams from websites or capture video from video hosting sites, such as YouTube, then as a general rule that is a violation of the copyright of the owner of the video.