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.

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