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.

73 lines
2.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .anvato import AnvatoIE
  4. from .sendtonews import SendtoNewsIE
  5. from ..compat import compat_urlparse
  6. from ..utils import unified_timestamp
  7. class CBSLocalIE(AnvatoIE):
  8. _VALID_URL = r'https?://[a-z]+\.cbslocal\.com/\d+/\d+/\d+/(?P<id>[0-9a-z-]+)'
  9. _TESTS = [{
  10. # Anvato backend
  11. 'url': 'http://losangeles.cbslocal.com/2016/05/16/safety-advocates-say-fatal-car-seat-failures-are-public-health-crisis',
  12. 'md5': 'f0ee3081e3843f575fccef901199b212',
  13. 'info_dict': {
  14. 'id': '3401037',
  15. 'ext': 'mp4',
  16. 'title': 'Safety Advocates Say Fatal Car Seat Failures Are \'Public Health Crisis\'',
  17. 'description': 'Collapsing seats have been the focus of scrutiny for decades, though experts say remarkably little has been done to address the issue. Randy Paige reports.',
  18. 'thumbnail': 're:^https?://.*',
  19. 'timestamp': 1463440500,
  20. 'upload_date': '20160516',
  21. 'subtitles': {
  22. 'en': 'mincount:5',
  23. },
  24. 'categories': [
  25. 'Stations\\Spoken Word\\KCBSTV',
  26. 'Syndication\\MSN',
  27. 'Syndication\\NDN',
  28. 'Syndication\\AOL',
  29. 'Syndication\\Yahoo',
  30. 'Syndication\\Tribune',
  31. 'Syndication\\Curb.tv',
  32. 'Content\\News'
  33. ],
  34. },
  35. }, {
  36. # SendtoNews embed
  37. 'url': 'http://cleveland.cbslocal.com/2016/05/16/indians-score-season-high-15-runs-in-blowout-win-over-reds-rapid-reaction/',
  38. 'info_dict': {
  39. 'id': 'GxfCe0Zo7D-175909-5588',
  40. },
  41. 'playlist_count': 9,
  42. 'params': {
  43. # m3u8 download
  44. 'skip_download': True,
  45. },
  46. }]
  47. def _real_extract(self, url):
  48. display_id = self._match_id(url)
  49. webpage = self._download_webpage(url, display_id)
  50. sendtonews_url = SendtoNewsIE._extract_url(webpage)
  51. if sendtonews_url:
  52. return self.url_result(
  53. compat_urlparse.urljoin(url, sendtonews_url),
  54. ie=SendtoNewsIE.ie_key())
  55. info_dict = self._extract_anvato_videos(webpage, display_id)
  56. time_str = self._html_search_regex(
  57. r'class="entry-date">([^<]+)<', webpage, 'released date', fatal=False)
  58. timestamp = unified_timestamp(time_str)
  59. info_dict.update({
  60. 'display_id': display_id,
  61. 'timestamp': timestamp,
  62. })
  63. return info_dict