philbot9 / youtube-info

Fetch meta information about YouTube videos
ISC License
43 stars 20 forks source link

Is video duration unreliable ? #10

Closed dxwc closed 5 years ago

dxwc commented 5 years ago

Installed latest from npm. On first few tries, I had durations consistently off by 20 to 50 seconds. On the same videos I am now consistently receiving 1 second more than actual duration on all that I tried.

let y = require('youtube-info');
y('ucZl6vQ_8Uo', (err, info) => console.log('Actual: 63, recieved:', info.duration));  // 64

The duration meta content when downloaded separately was PT1M4S. Did youtube add any new security feature that this might be triggering ? [ Or was my first few tries were fluke and generally a ± 1 second is expected ? ]


package : 1.3.2 node : 10.9.0 npm : 6.2.0

philbot9 commented 5 years ago

Thanks for the detailed description. Tbh, I don't have much of an answer for you.

Maybe the difference of 1 second is due to rounding. In the official YouTube Data API the duration for that video is also given as PT1M4S, so the problem lies with YouTube itself.

Regarding your initial 20-50 seconds deviation I have no explanation and as you pointed out it cannot be reproduced any longer. Possibly a temporary side-effect of some changes YouTube may have made.