- formats = []
- for formats_el in li.findall('.//a'):
- if formats_el.attrib['class'] != 'OverlayPanel':
- continue
- target = formats_el.attrib['target']
-
- format_code = formats_el.text
- if 'Automatic' in format_code:
- continue
-
- size_q = formats_el.attrib['href']
- size_id = size_q.rpartition('#videos-')[2]
- if size_id not in size_cache:
- size_url = url + size_q
- sizepage_html = self._download_webpage(
- size_url, movie,
- note=u'Downloading size info %s' % size_id,
- errnote=u'Error while downloading size info %s' % size_id,
- )
- _doc = xml.etree.ElementTree.fromstring(sizepage_html)
- size_cache[size_id] = _doc
-
- sizepage_doc = size_cache[size_id]
- links = sizepage_doc.findall('.//{http://www.w3.org/1999/xhtml}ul/{http://www.w3.org/1999/xhtml}li/{http://www.w3.org/1999/xhtml}a')
- for vid_a in links:
- href = vid_a.get('href')
- if not href.endswith(target):
- continue
- detail_q = href.partition('#')[0]
- detail_url = url + '/' + detail_q
+ first_url = trailer_info['url']
+ trailer_id = first_url.split('/')[-1].rpartition('_')[0].lower()
+ settings_json_url = compat_urlparse.urljoin(url, 'includes/settings/%s.json' % trailer_id)
+ settings_json = self._download_webpage(settings_json_url, trailer_id, u'Downloading settings json')
+ settings = json.loads(settings_json)