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.

45 lines
1.4 KiB

  1. import re
  2. from .common import InfoExtractor
  3. class UstreamIE(InfoExtractor):
  4. _VALID_URL = r'https?://www\.ustream\.tv/recorded/(?P<videoID>\d+)'
  5. IE_NAME = u'ustream'
  6. _TEST = {
  7. u'url': u'http://www.ustream.tv/recorded/20274954',
  8. u'file': u'20274954.flv',
  9. u'md5': u'088f151799e8f572f84eb62f17d73e5c',
  10. u'info_dict': {
  11. u"uploader": u"Young Americans for Liberty",
  12. u"title": u"Young Americans for Liberty February 7, 2012 2:28 AM"
  13. }
  14. }
  15. def _real_extract(self, url):
  16. m = re.match(self._VALID_URL, url)
  17. video_id = m.group('videoID')
  18. video_url = u'http://tcdn.ustream.tv/video/%s' % video_id
  19. webpage = self._download_webpage(url, video_id)
  20. self.report_extraction(video_id)
  21. video_title = self._html_search_regex(r'data-title="(?P<title>.+)"',
  22. webpage, u'title')
  23. uploader = self._html_search_regex(r'data-content-type="channel".*?>(?P<uploader>.*?)</a>',
  24. webpage, u'uploader', fatal=False, flags=re.DOTALL)
  25. thumbnail = self._html_search_regex(r'<link rel="image_src" href="(?P<thumb>.*?)"',
  26. webpage, u'thumbnail', fatal=False)
  27. info = {
  28. 'id': video_id,
  29. 'url': video_url,
  30. 'ext': 'flv',
  31. 'title': video_title,
  32. 'uploader': uploader,
  33. 'thumbnail': thumbnail,
  34. }
  35. return info