How to load Youtube Video?

How to load a Youtube Video?

  1. Import YouTubeVideo and timdelta in the following way
from IPython.display import YouTubeVideo
from datetime import timedelta

2. Write timedelta function to define a certain amount of time

timdelta()

3. Set hours, minutes and seconds parameters to chosen values

(timedelta(hours=0, minutes=0, seconds=10)

4. Count the number of seconds by applying .total_seconds() to previous result

timedelta(hours=0, minutes=0, seconds=10).total_seconds()

5. Turn the amount of seconds into an integer value

int(timedelta(hours=0, minutes=0, seconds=10).total_seconds())

6. Store result in a variable

start=int(timedelta(hours=0, minutes=0, seconds=10).total_seconds())

7. Write YouTubeVideo function
YouTubeVideo()

8. The first argument will be the link part that identifies the specific video. Notice all Youtube videos start with https://www.youtube.com/watch?v= and the remaining part is what makes them unique

YouTubeVideo('3liCbRZPrZA')

9. Set start parameter to the variable that represents the chosen amount of seconds to start in step 6

YouTubeVideo('3liCbRZPrZA', start=start)

10. Set autoplay parameter to 1, theme parameter to light and color parameter to red

YouTubeVideo('3liCbRZPrZA', start=start, autoplay=1, theme="light", color="red")

 

Leave a comment