def scrape_video(youtube_id, format='mp4', force=False, quiet=False, callback=None):
 video_filename = ('%(id)s.%(ext)s' % {'id': youtube_id, 'ext': format})
 video_file_download_path = os.path.join(settings.CONTENT_ROOT, video_filename)
 if (os.path.exists(video_file_download_path) and (not force)):
  return
 yt_dl = youtube_dl.YoutubeDL({'outtmpl': video_file_download_path, 'quiet': quiet})
 yt_dl.add_default_info_extractors()
 if callback:
  yt_dl.add_progress_hook(callback)
 yt_dl.extract_info(('www.youtube.com/watch?v=%s' % youtube_id), download=True)

def scrape_video ( youtube_id , format = 'mp4' , force = False , quiet = False , callback = None ) : video_filename = ( '%(id)s.%(ext)s' % { 'id' : youtube_id , 'ext' : format } ) video_file_download_path = os . path . join ( settings . CONTENT_ROOT , video_filename ) if ( os . path . exists ( video_file_download_path ) and ( not force ) ) : return yt_dl = youtube_dl . YoutubeDL ( { 'outtmpl' : video_file_download_path , 'quiet' : quiet } ) yt_dl . add_default_info_extractors ( ) if callback : yt_dl . add_progress_hook ( callback ) yt_dl . extract_info ( ( 'www.youtube.com/watch?v=%s' % youtube_id ) , download = True )
assumes its in the path; if not .