atttechchannel.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from .common import InfoExtractor
  2. from ..utils import unified_strdate
  3. class ATTTechChannelIE(InfoExtractor):
  4. _VALID_URL = r'https?://techchannel\.att\.com/play-video\.cfm/([^/]+/)*(?P<id>.+)'
  5. _TEST = {
  6. 'url': 'http://techchannel.att.com/play-video.cfm/2014/1/27/ATT-Archives-The-UNIX-System-Making-Computers-Easier-to-Use',
  7. 'info_dict': {
  8. 'id': '11316',
  9. 'display_id': 'ATT-Archives-The-UNIX-System-Making-Computers-Easier-to-Use',
  10. 'ext': 'flv',
  11. 'title': 'AT&T Archives : The UNIX System: Making Computers Easier to Use',
  12. 'description': 'A 1982 film about UNIX is the foundation for software in use around Bell Labs and AT&T.',
  13. 'thumbnail': r're:^https?://.*\.jpg$',
  14. 'upload_date': '20140127',
  15. },
  16. 'params': {
  17. # rtmp download
  18. 'skip_download': True,
  19. },
  20. }
  21. def _real_extract(self, url):
  22. display_id = self._match_id(url)
  23. webpage = self._download_webpage(url, display_id)
  24. video_url = self._search_regex(
  25. r"url\s*:\s*'(rtmp://[^']+)'",
  26. webpage, 'video URL')
  27. video_id = self._search_regex(
  28. r'mediaid\s*=\s*(\d+)',
  29. webpage, 'video id', fatal=False)
  30. title = self._og_search_title(webpage)
  31. description = self._og_search_description(webpage)
  32. thumbnail = self._og_search_thumbnail(webpage)
  33. upload_date = unified_strdate(self._search_regex(
  34. r'[Rr]elease\s+date:\s*(\d{1,2}/\d{1,2}/\d{4})',
  35. webpage, 'upload date', fatal=False), False)
  36. return {
  37. 'id': video_id,
  38. 'display_id': display_id,
  39. 'url': video_url,
  40. 'ext': 'flv',
  41. 'title': title,
  42. 'description': description,
  43. 'thumbnail': thumbnail,
  44. 'upload_date': upload_date,
  45. }