Browse Source

[glide] Simplify

totalwebcasting
Philipp Hagemeister 10 years ago
parent
commit
1ede5b2481
2 changed files with 14 additions and 7 deletions
  1. +1
    -1
      youtube_dl/extractor/common.py
  2. +13
    -6
      youtube_dl/extractor/glide.py

+ 1
- 1
youtube_dl/extractor/common.py View File

@ -618,7 +618,7 @@ class InfoExtractor(object):
formats.sort(key=_formats_key) formats.sort(key=_formats_key)
def http_scheme(self): def http_scheme(self):
""" Either "https:" or "https:", depending on the user's preferences """
""" Either "http:" or "https:", depending on the user's preferences """
return ( return (
'http:' 'http:'
if self._downloader.params.get('prefer_insecure', False) if self._downloader.params.get('prefer_insecure', False)


+ 13
- 6
youtube_dl/extractor/glide.py View File

@ -14,20 +14,27 @@ class GlideIE(InfoExtractor):
'id': 'UZF8zlmuQbe4mr+7dCiQ0w==', 'id': 'UZF8zlmuQbe4mr+7dCiQ0w==',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Damon Timm\'s Glide message', 'title': 'Damon Timm\'s Glide message',
'thumbnail' : 'http://dk608k4lm7m9j.cloudfront.net/3ee7da5af87065a1eeb8c6c9a864ba5b_2.jpg'
'thumbnail': 're:^https?://.*?\.cloudfront\.net/.*\.jpg$',
} }
} }
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title')
video_url = self._search_regex(r'<source src="(.*?)" type="video/mp4">', webpage, 'video_url')
thumbnail_url = self._search_regex(r'<img id="video-thumbnail" src="(.*?)" alt="Video thumbnail">', webpage, 'thumbnail_url')
title = self._html_search_regex(
r'<title>(.*?)</title>', webpage, 'title')
video_url = self.http_scheme() + self._search_regex(
r'<source src="(.*?)" type="video/mp4">', webpage, 'video URL')
thumbnail_url = self._search_regex(
r'<img id="video-thumbnail" src="(.*?)"',
webpage, 'thumbnail url', fatal=False)
thumbnail = (
thumbnail_url if thumbnail_url is None
else self.http_scheme() + thumbnail_url)
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
'url' : 'http:' + video_url,
'thumbnail' : 'http:' + thumbnail_url
'url': video_url,
'thumbnail': thumbnail,
} }

Loading…
Cancel
Save