The full ffprobe output is a wall of text, and scripts hate walls. Three options turn it into a single line that you can read in a shell variable.
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 in.mp4
-select_streams v:0 limits the output to the first video stream. -show_entries stream=width,height keeps only those two fields. -of csv=p=0 prints them as comma-separated values without the section name in front. For a 640 by 360 clip the result is 640,360.
The same pattern works for the container. -show_entries format=duration prints the length in seconds. If you prefer labels over positions, use -of default=noprint_wrappers=1, which gives width=640 and height=360 on separate lines.
-v error hides the banner, so only the values reach your script.
A caveat: when a field is missing in the file, ffprobe leaves the column out or prints N/A, and a script that splits on commas then shifts. Check the output before you trust a position, and select the stream you mean, because a file with two video streams (for instance cover art) changes what v:0 is.
Further reading: ffprobe documentation