aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/viewster.py
diff options
context:
space:
mode:
authorremitamine <remitamine@gmail.com>2016-04-24 14:33:47 +0100
committerremitamine <remitamine@gmail.com>2016-04-24 14:34:28 +0100
commitc14dc00df33f29f681f1cc3424783acaee7efbb7 (patch)
tree2b23d821827184dedc7af21379684eead7ffceef /youtube_dl/extractor/viewster.py
parent03dd60ca41ddb2dec3723ac6446bd291a94cad18 (diff)
[viewster] improve http formats extraction
Diffstat (limited to 'youtube_dl/extractor/viewster.py')
-rw-r--r--youtube_dl/extractor/viewster.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/youtube_dl/extractor/viewster.py b/youtube_dl/extractor/viewster.py
index 4289a2f31..7839225d4 100644
--- a/youtube_dl/extractor/viewster.py
+++ b/youtube_dl/extractor/viewster.py
@@ -146,21 +146,26 @@ class ViewsterIE(InfoExtractor):
qualities_basename = self._search_regex(
'/([^/]+)\.csmil/',
manifest_url, 'qualities basename', default=None)
- if qualities_basename:
- QUALITIES_RE = r'((,\d+k)+,?)'
- qualities = self._search_regex(
- QUALITIES_RE, qualities_basename,
- 'qualities').strip(',').split(',')
- http_template = re.sub(QUALITIES_RE, r'%s', qualities_basename)
- http_url_basename = url_basename(video_url)
- for q in qualities:
- formats.append({
- 'url': video_url.replace(http_url_basename, http_template % q),
- 'ext': 'mp4',
- 'format_id': 'http-%s' % q,
- 'tbr': int_or_none(self._search_regex(
- r'(\d+)k', q, 'bitrate', default=None)),
- })
+ if not qualities_basename:
+ continue
+ QUALITIES_RE = r'((,\d+k)+,?)'
+ qualities = self._search_regex(
+ QUALITIES_RE, qualities_basename,
+ 'qualities', default=None)
+ if not qualities:
+ continue
+ qualities = qualities.strip(',').split(',')
+ http_template = re.sub(QUALITIES_RE, r'%s', qualities_basename)
+ http_url_basename = url_basename(video_url)
+ for q in qualities:
+ tbr = int_or_none(self._search_regex(
+ r'(\d+)k', q, 'bitrate', default=None))
+ formats.append({
+ 'url': video_url.replace(http_url_basename, http_template % q),
+ 'ext': 'mp4',
+ 'format_id': 'http' + ('-%d' % tbr if tbr else ''),
+ 'tbr': tbr,
+ })
if not formats and not info.get('LanguageSets') and not info.get('VODSettings'):
self.raise_geo_restricted()