Unfortunately, you cannot directly play YouTube videos on the TV in The Sims 2. Here's why:
No internet functionality: The Sims 2 was released before internet integration became standard in games.
Pre-programmed channels: The in-game TV only offers a limited set of pre-recorded channels; you cannot add custom ones.
Workarounds you can try:
Custom content: Some creators have made custom TV sets or channels that mimic video playback. This is the closest way to get a similar experience.
Screen capture & video editing: Record a YouTube video on your PC, convert it to a format compatible with The Sims 2, and use a custom TV mod designed to play local video files.
Watch on a second device: Simply play YouTube on a phone, tablet, or second monitor while your Sims watch their in-game TV.
Note: Custom content can sometimes cause game instability. Always back up your saves and download from reputable sources.