]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/glide.py
Adapt changes from Andreas Tille for porting to Salsa.
[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's Glide message",
17 'thumbnail': r're:^https?://.*?\.cloudfront\.net/.*\.jpg$',
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23
24 webpage = self._download_webpage(url, video_id)
25
26 title = self._html_search_regex(
27 r'<title>(.+?)</title>', webpage,
28 'title', default=None) or self._og_search_title(webpage)
29 video_url = self._proto_relative_url(self._search_regex(
30 r'<source[^>]+src=(["\'])(?P<url>.+?)\1',
31 webpage, 'video URL', default=None,
32 group='url')) or self._og_search_video_url(webpage)
33 thumbnail = self._proto_relative_url(self._search_regex(
34 r'<img[^>]+id=["\']video-thumbnail["\'][^>]+src=(["\'])(?P<url>.+?)\1',
35 webpage, 'thumbnail url', default=None,
36 group='url')) or self._og_search_thumbnail(webpage)
37
38 return {
39 'id': video_id,
40 'title': title,
41 'url': video_url,
42 'thumbnail': thumbnail,
43 }