You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4 KiB

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