@login_required
def replace_transcripts(request):
 response = {'status': 'Error', 'subs': ''}
 try:
  (__, videos, item) = _validate_transcripts_data(request)
 except TranscriptsRequestValidationException as e:
  return error_response(response, e.message)
 youtube_id = videos['youtube']
 if (not youtube_id):
  return error_response(response, 'YouTube id {} is not presented in request data.'.format(youtube_id))
 try:
  download_youtube_subs(youtube_id, item, settings)
 except GetTranscriptsFromYouTubeException as e:
  return error_response(response, e.message)
 item.sub = youtube_id
 item.save_with_metadata(request.user)
 response = {'status': 'Success', 'subs': item.sub}
 return JsonResponse(response)

@ login_required def replace_transcripts ( request ) : response = { 'status' : 'Error' , 'subs' : '' } try : ( __ , videos , item ) = _validate_transcripts_data ( request ) except TranscriptsRequestValidationException as e : return error_response ( response , e . message ) youtube_id = videos [ 'youtube' ] if ( not youtube_id ) : return error_response ( response , 'YouTube id {} is not presented in request data.' . format ( youtube_id ) ) try : download_youtube_subs ( youtube_id , item , settings ) except GetTranscriptsFromYouTubeException as e : return error_response ( response , e . message ) item . sub = youtube_id item . save_with_metadata ( request . user ) response = { 'status' : 'Success' , 'subs' : item . sub } return JsonResponse ( response )
replaces all transcripts with youtube ones .