def select_url_from_video_api(html):
 c = json.loads(html)
 video_dic = {}
 for i in c['mp4']:
  video_dic[i['code']] = i['http']
 quality_preference_list = ['sdvd', 'hd', 'dvd', 'sd']
 url = [video_dic[quality] for quality in quality_preference_list if (quality in video_dic)][0]
 html = get_html(url)
 c = json.loads(html)
 return [i['urls'][0] for i in c['playlist']]

def select_url_from_video_api ( html ) : c = json . loads ( html ) video_dic = { } for i in c [ 'mp4' ] : video_dic [ i [ 'code' ] ] = i [ 'http' ] quality_preference_list = [ 'sdvd' , 'hd' , 'dvd' , 'sd' ] url = [ video_dic [ quality ] for quality in quality_preference_list if ( quality in video_dic ) ] [ 0 ] html = get_html ( url ) c = json . loads ( html ) return [ i [ 'urls' ] [ 0 ] for i in c [ 'playlist' ] ]
str->str choose the best one .