How to get a direct link to the YouTube video?

Good time of day. Tell me how to get a direct link (or send request using cURL) on a video in YouTube.
Now doing so, to get meta informationай... with
$data = file_get_contents("айди_видео");

There find the link to the video, but for some reason, some video links do not provide, and receive an answer here:
{"playabilityStatus":{"status":"UNPLAYABLE","reason":"This video is unavailable.","errorScreen":{"playerErrorMessageRenderer":{"reason":{"simpleText":"This video is nedostupno."},"proceedButton":{"buttonRenderer":{"style":"STYLE_PRIMARY","size":"SIZE_DEFAULT","isDisabled":false,"text":{"simpleText":"Look at YouTube"},"trackingParams":"CAQQ8FsiEwjU34jNju_oAhWNdbIKHSxYdqa="}},"thumbnail":{"thumbnails":[{"url":"//","width":140,"height":100}]},"icon":{"iconType":"ERROR_OUTLINE"}}},"contextParams":"Q0FFU0FnZ0M="},"videoDetails"

For what reason? Video is available for viewing on YouTube. I can not understand.
Please tell me how to get the link via meta or how to handle differently to YouTube to get the direct link and info about the video. Thank you.
April 19th 20 at 12:30
1 answer
April 19th 20 at 12:32
I think because there is the query format suggested by YouTube:

and desired parameters

Find more questions by tags PHPYouTube