问题
This one is a simple question, but I have no experience in this topic, so I would like to use your help. So, the question is (as the title says):
How can I determine the length(duration in sec) of a YouTube video?
It would be great if this information is available from HTML source. But any other idea is good, I'm currently just brainstorming about a new application, where the duration of the videos is strongly important.
Do you have any idea?
回答1:
You can use javascript youtube api. You can find our more on this link https://developers.google.com/youtube/js_api_reference#Retrieving_video_information
Where you have method on player:
player.getDuration()
来源:https://stackoverflow.com/questions/21635984/how-to-determine-the-length-of-a-youtube-video