def summarize(youtube_url, output=None):
"""
If the output is None, we don't generate a summary
and simply return metadata.
"""
# default downloads to "youtubeID.mp4"
youtube_id = download_video(youtube_url)
meta_data = VideoMetadata()
clips = get_subclips(youtube_id, meta_data)
if output is not None:
rechunk_video(youtube_id+".mp4", output, clips)
return meta_data
else:
return meta_data
class VideoMetadata(object):
def __init__(self):
self.hot_clips = []
self.timestamps = []
self.duration = None
if __name__ == '__main__':
# parser = argparse.ArgumentParser(description='download and summarize youtube videos')
# parser.add_argument('-f', '--filename', type=str, default='', help='Enter a filename')
# parser.add_argument('-u', '--url', type=str, default='', help='Enter a youtube url')
# args = parser.parse_args()
# filename = args.filename
# url = args.url
summarize('http://www.youtube.com/watch?v=YkADj0TPrJA', 'finished_from_api.mp4')
NameError Traceback (most recent call last)
<ipython-input-15-4e3dee00e1a5> in <module>
1 if __name__ == '__main__':
----> 2 summarize('http://www.youtube.com/watch?v=YkADj0TPrJA', 'finished_from_api.mp4')
<ipython-input-13-d2a7e1a184c9> in summarize(youtube_url, output)
5 """
6 # default downloads to "youtubeID.mp4"
----> 7 youtube_id = download_video(youtube_url)
8
9 meta_data = VideoMetadata()
NameError: name 'download_video' is not defined