2

The URL's for YouTube Clips appear to follow no logic other than they have: https://youtube.com/clip/Ugkx + 32 characters.

For example, for a 15 second clip starting at the beginning of:
https://www.youtube.com/watch?v=NiXD4xVJM5Y&ab_channel=JamieDupuis

The link is:
https://youtube.com/clip/UgkxU2HSeGL_NvmDJ-nQJrlLwllwMDBdGZFs

There is nothing in the URL that would suggest it starts at 0 seconds, last 15 seconds or comes from video ID NiXD4xVJM5Y.

From the HTML I was able to find:

<html>
...
<body>
...
<ytd-app>
...
<div#content.style-scope.ytd-app>
...
<ytd-page-manager#page-manager.style-scope.ytd-app>
...
<ytd-watch-flexy class="style-scope ytd-page-manager hide-skeleton" video-id="NiXD4xVJM5Y"...>

But I cannot find the start point, end point, and/or duration.

Ideally, I would use a Python package to read the HTML, get the start and end point or get the start point and determine the end point by adding the duration.

1 Answer 1

1

Turns out in the source code there are the three variables I am looking for:

  • videoId
  • startTimeMs
  • endTimeMs

No need for the YouTube API, just selenium to access this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.