]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/glide.py
Update the changelog.
[youtubedl] / youtube_dl / extractor / glide.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import unified_strdate
6
7
8 class GlideIE(InfoExtractor):
9 IE_DESC = 'Glide mobile video messages (glide.me)'
10 _VALID_URL = r'https?://share\.glide\.me/(?P<id>[A-Za-z0-9\-=_+]+)'
11 _TEST = {
12 'url': 'http://share.glide.me/UZF8zlmuQbe4mr+7dCiQ0w==',
13 'md5': '4466372687352851af2d131cfaa8a4c7',
14 'info_dict': {
15 'id': 'UZF8zlmuQbe4mr+7dCiQ0w==',
16 'ext': 'mp4',
17 'title': 'Damon Timm\'s Glide message',
18 'thumbnail': 're:^https?://.*?\.cloudfront\.net/.*\.jpg$',
19 'uploader': 'Damon Timm',
20 'upload_date': '20140919',
21 }
22 }
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26
27 webpage = self._download_webpage(url, video_id)
28
29 title = self._html_search_regex(
30 r'<title>(.+?)</title>', webpage, 'title')
31 video_url = self._proto_relative_url(self._search_regex(
32 r'<source[^>]+src=(["\'])(?P<url>.+?)\1',
33 webpage, 'video URL', default=None,
34 group='url')) or self._og_search_video_url(webpage)
35 thumbnail = self._proto_relative_url(self._search_regex(
36 r'<img[^>]+id=["\']video-thumbnail["\'][^>]+src=(["\'])(?P<url>.+?)\1',
37 webpage, 'thumbnail url', default=None,
38 group='url')) or self._og_search_thumbnail(webpage)
39 uploader = self._search_regex(
40 r'<div[^>]+class=["\']info-name["\'][^>]*>([^<]+)',
41 webpage, 'uploader', fatal=False)
42 upload_date = unified_strdate(self._search_regex(
43 r'<div[^>]+class="info-date"[^>]*>([^<]+)',
44 webpage, 'upload date', fatal=False))
45
46 return {
47 'id': video_id,
48 'title': title,
49 'url': video_url,
50 'thumbnail': thumbnail,
51 'uploader': uploader,
52 'upload_date': upload_date,
53 }