W
W
weranda2018-02-03 10:31:49
YouTube
weranda, 2018-02-03 10:31:49

How to get data about a video file from YouTube (name, duration, etc.)?

Greetings
I am adding a video to a page from YouTube and its markup. I have two options:
Option 1
Manually add the HTML markup of the YouTube roll to the HTML:

<div itemscope itemtype="http://schema.org/VideoObject">
    <h2 itemprop="name">111</h2><br>
    <span itemprop="description">333</span>
    <link itemprop="url" href="https://www.youtube.com/watch?v=8Ka4eKyDkxc">
    <meta itemprop="duration" content="PT6M58S">
    и так далее

Option 2.
Somehow get data from YouTube and substitute it in the markup.
There are no problems with the first option. It is the second option that interests me, but for lack of special knowledge and understanding of how to do this, I ask for your advice. Can you please tell me if there are any simple ways to get data about the video? Any requests...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2018-02-03
@politon

https://developers.google.com/youtube/v3/

D
Dima Pautov, 2018-02-03
@bootd

Use Youtube's API. The link has been sent to you above. Connect the api and have access to all player events, the start of viewing, the current time, the end of the video, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question