The below link will return a json response which contains the video dimensions and other details:
https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=[video_ID ]&format=json
Replace the [video_ID] with the ID of the concerned video. For example:
https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=zvlvjY-_Vgw&format=json
The above returns the following json object:
{
"title": "The Design Order Store - How to use our templates",
"author_name": "The Design Order",
"author_url": "https://www.youtube.com/channel/UCBFmH7qo_xKGSkbA5JSpslg",
"type": "video",
"height": 113,
"width": 200,
"version": "1.0",
"provider_name": "YouTube",
"provider_url": "https://www.youtube.com/",
"thumbnail_height": 360,
"thumbnail_width": 480,
"thumbnail_url": "https://i.ytimg.com/vi/zvlvjY-_Vgw/hqdefault.jpg",
"html": "\u003ciframe width=\u0022200\u0022 height=\u0022113\u0022 src=\u0022https://www.youtube.com/embed/zvlvjY-_Vgw?feature=oembed\u0022 frameborder=\u00220\u0022 allow=\u0022accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\u0022 allowfullscreen\u003e\u003c/iframe\u003e"
}
