logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

bfi.py (1341B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import extract_attributes
  6. class BFIPlayerIE(InfoExtractor):
  7. IE_NAME = 'bfi:player'
  8. _VALID_URL = r'https?://player\.bfi\.org\.uk/[^/]+/film/watch-(?P<id>[\w-]+)-online'
  9. _TEST = {
  10. 'url': 'https://player.bfi.org.uk/free/film/watch-computer-doctor-1974-online',
  11. 'md5': 'e8783ebd8e061ec4bc6e9501ed547de8',
  12. 'info_dict': {
  13. 'id': 'htNnhlZjE60C9VySkQEIBtU-cNV1Xx63',
  14. 'ext': 'mp4',
  15. 'title': 'Computer Doctor',
  16. 'description': 'md5:fb6c240d40c4dbe40428bdd62f78203b',
  17. },
  18. 'skip': 'BFI Player films cannot be played outside of the UK',
  19. }
  20. def _real_extract(self, url):
  21. video_id = self._match_id(url)
  22. webpage = self._download_webpage(url, video_id)
  23. entries = []
  24. for player_el in re.findall(r'(?s)<[^>]+class="player"[^>]*>', webpage):
  25. player_attr = extract_attributes(player_el)
  26. ooyala_id = player_attr.get('data-video-id')
  27. if not ooyala_id:
  28. continue
  29. entries.append(self.url_result(
  30. 'ooyala:' + ooyala_id, 'Ooyala',
  31. ooyala_id, player_attr.get('data-label')))
  32. return self.playlist_result(entries)