youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

bfi.py (1341B)


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