[utils] change extract_attributes to work in python 2
authorremitamine <remitamine@gmail.com>
Sat, 31 Oct 2015 18:36:04 +0000 (19:36 +0100)
committerremitamine <remitamine@gmail.com>
Sat, 31 Oct 2015 18:36:04 +0000 (19:36 +0100)
youtube_dl/extractor/brightcove.py
youtube_dl/utils.py

index b41cee91baa89d886077b5caaa138dfdc8b74f7f..c6ad1d065512a138b6f4535cce577eb81238debf 100644 (file)
@@ -383,8 +383,7 @@ class BrightcoveInPageEmbedIE(InfoExtractor):
         return None
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
-        account_id, player_id, embed, video_id = mobj.groups()
+        account_id, player_id, embed, video_id = re.match(self._VALID_URL, url).groups()
 
         webpage = self._download_webpage('http://players.brightcove.net/%s/%s_%s/index.min.js' % (account_id, player_id, embed), video_id)
 
index bcebf9cc5cd278a33c4df11c1feecd19d919e23a..518cea98bd52639403caaf16dc7a5137651e5e2f 100644 (file)
@@ -252,7 +252,8 @@ def extract_attributes(attributes_str, attributes_regex=r'(?s)\s*([^\s=]+)\s*=\s
     attributes = re.findall(attributes_regex, attributes_str)
     attributes_dict = {}
     if attributes:
-        attributes_dict = {attribute_name: attribute_value for (attribute_name, attribute_value) in attributes}
+        for (attribute_name, attribute_value) in attributes:
+            attributes_dict[attribute_name] = attribute_value
     return attributes_dict