Well, if you don't want to use the API and would like to use curl, here's a super ugly answer to match :)
Marks-MacBook-Air:~ mstanislav$ curl -s http://www.youtube.com/watch?v=dQw4w9WgXcQ |grep '<meta itemprop="duration"'
<meta itemprop="duration" content="PT3M33S">
The PT3M33S means 3 minutes and 33 seconds, which is the duration. Just process the data from there (via shell script or otherwise you're using curl with). Be kind voters, just answering the question as requested ;)
For the sake of everything happy, here's using curl with the API, which, does not require a developer key unless you are uploading or writing data.
curl -s 'http://gdata.youtube.com/feeds/api/videos/dQw4w9WgXcQ?v=2&alt=jsonc'