[vimeo] Fix the extraction for some 'player' or 'pro' videos

The variable the config dict is assigned to can change, now we try to detect it or fallback to a, b or c
pull/2004/head
Jaime Marquínez Ferrándiz 2013-12-10 20:28:12 +01:00
parent 5458b4cefb
commit 48ad51b243
1 changed files with 8 additions and 2 deletions

View File

@ -151,8 +151,14 @@ class VimeoIE(InfoExtractor):
config = json.loads(config_json) config = json.loads(config_json)
except RegexNotFoundError: except RegexNotFoundError:
# For pro videos or player.vimeo.com urls # For pro videos or player.vimeo.com urls
config = self._search_regex([r' = {config:({.+?}),assets:', r'(?:c|b)=({.+?});'], # We try to find out to which variable is assigned the config dic
webpage, u'info section', flags=re.DOTALL) m_variable_name = re.search('(\w)\.video\.id', webpage)
if m_variable_name is not None:
config_re = r'%s=({.+?});' % re.escape(m_variable_name.group(1))
else:
config_re = [r' = {config:({.+?}),assets:', r'(?:[abc])=({.+?});']
config = self._search_regex(config_re, webpage, u'info section',
flags=re.DOTALL)
config = json.loads(config) config = json.loads(config)
except Exception as e: except Exception as e:
if re.search('The creator of this video has not given you permission to embed it on this domain.', webpage): if re.search('The creator of this video has not given you permission to embed it on this domain.', webpage):