]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/glide.py
9561ed5fbaa25404654303956a676b000da2af67
[youtubedl] / youtube_dl / extractor / glide.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class GlideIE(InfoExtractor):
8 IE_DESC = 'Glide mobile video messages (glide.me)'
9 _VALID_URL = r'https?://share\.glide\.me/(?P<id>[A-Za-z0-9\-=_+]+)'
10 _TEST = {
11 'url': 'http://share.glide.me/UZF8zlmuQbe4mr+7dCiQ0w==',
12 'md5': '4466372687352851af2d131cfaa8a4c7',
13 'info_dict': {
14 'id': 'UZF8zlmuQbe4mr+7dCiQ0w==',
15 'ext': 'mp4',
16 'title': 'Damon Timm\'s Glide message',
17 'thumbnail': 're:^https?://.*?\.cloudfront\.net/.*\.jpg$',
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 webpage = self._download_webpage(url, video_id)
24 title = self._html_search_regex(
25 r'<title>(.*?)</title>', webpage, 'title')
26 video_url = self.http_scheme() + self._search_regex(
27 r'<source src="(.*?)" type="video/mp4">', webpage, 'video URL')
28 thumbnail_url = self._search_regex(
29 r'<img id="video-thumbnail" src="(.*?)"',
30 webpage, 'thumbnail url', fatal=False)
31 thumbnail = (
32 thumbnail_url if thumbnail_url is None
33 else self.http_scheme() + thumbnail_url)
34
35 return {
36 'id': video_id,
37 'title': title,
38 'url': video_url,
39 'thumbnail': thumbnail,
40 }