import the objects needed from the youtube_editor package
In [1]:
from IPython.core.display import display, HTML
In [2]:
from youtube_editor.youtube_editor import (
get_youtube_url_from, # pass a YouTube video id to get special url
get_embed_string_from, # pass an excerpt tuple from edits to get the embed string,
get_video_excerpts_map, # pass in the edits chosen to get a mapping
)
In [3]:
from youtube_editor.time_picker import (
cell_magic,
youtube_edits,
write_youtube_edits,
)
In [5]:
# Enter data
# press button
# youtube_edits variable is appended
get_ipython().run_cell_magic('HTML', '', cell_magic)
In [6]:
# write a file which resutls in a python module with variable edits in it
write_youtube_edits(youtube_edits)
# import edits
from youtube_edits import edits
In [7]:
edits
Out[7]:
In [8]:
mapping = get_video_excerpts_map(edits)
In [9]:
url = get_youtube_url_from('gz5TPI2sSTo')
for key, value in mapping.items():
display(HTML(get_embed_string_from(value, url)))