We know Mathematica supports communication with different programming languages via external connectors. I will show a way with Python here. Main idea is to import the YouTube streaming link using an external python library (pytube).
I assume OP has Python installed in the system and it can be accessed via functions like ExternalEvaluatein Mathematica. Now to keep things really clean we will follow these standard practices.
Initial setup
Create a python virtual environment named youtube for this specific python task. We will use few handy functions from the function repository.
env = ResourceFunction["CreatePythonVirtualEnvironment"]["youtube"]; register = FindExternalEvaluators["Python"][env]; (* location of the virtual environment executable *) target = If[register["Registered"], register["Target"], None]
C:\Users\rob\Documents\youtube\Scripts\python.exe
If we have Python ready with the virtual environment youtube registered successfully (meansthe above variable target should point to a file location and not be None) then we initiate a session and install the external library pytube.
(* start external python session within the virtual environment *) session = StartExternalSession[<|"System"->"Python","Target":>target|>]; (* install the 'pytube' library *) ResourceFunction["PythonPackageInstall"][session, "pytube"]; DeleteObject[session]
This initial setup takes a bit of time but only needed to be done once.
Programmable access to YouTube video
Lets copy paste few lines of pytube specific code via fast Googling. More info here in docs.
(* virtual env's python executable location *) target = "C:\\Users\\rob\\Documents\\youtube\\Scripts\\python.exe"; (* pytube specific code *) code = StringTemplate[" from pytube import YouTube yt = YouTube('``') yt.streams.filter(file_extension='mp4').get_by_itag(22).url "]; (* start a session where we have pytube installed already *) session = StartExternalSession[<|"System"->"Python","Target":>target|>]; getStreamingURL = ExternalEvaluate[session, code[#]] &;
We can have a VideoStream object for any public YouTube video URL now! Just pass the target YouTube video's url to the function getStreamingURL.
stream = VideoStream[getStreamingURL["https://www.youtube.com/embed/HQefO4iLM0g"]]
We have access to this stream programmatically from Mathematica.
VideoPlay[stream]; Dynamic[stream["CurrentFrame"]]

Let's pause the video to take screenshot.
VideoPause[stream]
At this point it should be possible to make a simple video player. There is an example in VideoStream documentation:
https://wolfram.com/xid/0rtdyu3b6-sx6zp0
Clean up time!
Once we are done we can delete the python session started externally via StartExternalSession.
DeleteObject[session]
If needed we can also safely get rid of the virtual environment (named youtube) created for this experiment by deleting the root directory named youtube in the path (was stored as target above) of the python executable for this environment.
If[StringQ[target], DeleteDirectory[ Composition[ FileNameJoin, Take[#, UpTo[First@Flatten@Position[#, "youtube"]]] &, FileNameSplit ]@target, DeleteContents -> True ] ]
youtube-dl, and then write a small wrapper function that downloads the video using youtube-dl, and wraps the resulting file inVideo. Another option would simply be hosting a video file yourself somewhere outside of YouTube (possibly including, for instance,CloudPublish). $\endgroup$