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