- video_urls = list(map(compat_urllib_parse_unquote, re.findall(r"player_quality_[0-9]{3}p\s*=\s*'([^']+)'", webpage)))
+ video_variables = {}
+ for video_variablename, quote, video_variable in re.findall(
+ r'(player_quality_[0-9]{3,4}p\w+)\s*=\s*(["\'])(.+?)\2;', webpage):
+ video_variables[video_variablename] = video_variable
+
+ video_urls = []
+ for encoded_video_url in re.findall(
+ r'player_quality_[0-9]{3,4}p\s*=(.+?);', webpage):
+ for varname, varval in video_variables.items():
+ encoded_video_url = encoded_video_url.replace(varname, varval)
+ video_urls.append(re.sub(r'[\s+]', '', encoded_video_url))
+