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.

39 lines
1.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class ETOnlineIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?etonline\.com/(?:[^/]+/)*(?P<id>[^/?#&]+)'
  7. _TESTS = [{
  8. 'url': 'http://www.etonline.com/tv/211130_dove_cameron_liv_and_maddie_emotional_episode_series_finale/',
  9. 'info_dict': {
  10. 'id': '211130_dove_cameron_liv_and_maddie_emotional_episode_series_finale',
  11. 'title': 'md5:a21ec7d3872ed98335cbd2a046f34ee6',
  12. 'description': 'md5:8b94484063f463cca709617c79618ccd',
  13. },
  14. 'playlist_count': 2,
  15. }, {
  16. 'url': 'http://www.etonline.com/media/video/here_are_the_stars_who_love_bringing_their_moms_as_dates_to_the_oscars-211359/',
  17. 'only_matching': True,
  18. }]
  19. BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1242911076001/default_default/index.html?videoId=ref:%s'
  20. def _real_extract(self, url):
  21. playlist_id = self._match_id(url)
  22. webpage = self._download_webpage(url, playlist_id)
  23. entries = [
  24. self.url_result(
  25. self.BRIGHTCOVE_URL_TEMPLATE % video_id, 'BrightcoveNew', video_id)
  26. for video_id in re.findall(
  27. r'site\.brightcove\s*\([^,]+,\s*["\'](title_\d+)', webpage)]
  28. return self.playlist_result(
  29. entries, playlist_id,
  30. self._og_search_title(webpage, fatal=False),
  31. self._og_search_description(webpage))