[ie/dplay] Fix extractors (#10471)
[yt-dlp3.git] / yt_dlp / extractor / ukcolumn.py
blobf141804c801e7bbb3af2427dffe06359d21ae1f0
1 from .common import InfoExtractor
2 from .vimeo import VimeoIE
3 from .youtube import YoutubeIE
4 from ..utils import (
5 ExtractorError,
6 unescapeHTML,
7 urljoin,
11 class UkColumnIE(InfoExtractor):
12 _WORKING = False
13 IE_NAME = 'ukcolumn'
14 _VALID_URL = r'(?i)https?://(?:www\.)?ukcolumn\.org(/index\.php)?/(?:video|ukcolumn-news)/(?P<id>[-a-z0-9]+)'
16 _TESTS = [{
17 'url': 'https://www.ukcolumn.org/ukcolumn-news/uk-column-news-28th-april-2021',
18 'info_dict': {
19 'id': '541632443',
20 'ext': 'mp4',
21 'title': 'UK Column News - 28th April 2021',
22 'uploader_id': 'ukcolumn',
23 'uploader': 'UK Column',
25 'add_ie': [VimeoIE.ie_key()],
26 'expected_warnings': ['Unable to download JSON metadata'],
27 'params': {
28 'skip_download': 'Handled by Vimeo',
30 }, {
31 'url': 'https://www.ukcolumn.org/video/insight-eu-military-unification',
32 'info_dict': {
33 'id': 'Fzbnb9t7XAw',
34 'ext': 'mp4',
35 'title': 'Insight: EU Military Unification',
36 'uploader_id': 'ukcolumn',
37 'description': 'md5:29a207965271af89baa0bc191f5de576',
38 'uploader': 'UK Column',
39 'upload_date': '20170514',
41 'add_ie': [YoutubeIE.ie_key()],
42 'params': {
43 'skip_download': 'Handled by Youtube',
45 }, {
46 'url': 'https://www.ukcolumn.org/index.php/ukcolumn-news/uk-column-news-30th-april-2021',
47 'only_matching': True,
50 def _real_extract(self, url):
51 display_id = self._match_id(url)
52 webpage = self._download_webpage(url, display_id)
54 oembed_url = urljoin(url, unescapeHTML(self._search_regex(
55 r'<iframe[^>]+src=(["\'])(?P<url>/media/oembed\?url=.+?)\1',
56 webpage, 'OEmbed URL', group='url')))
57 oembed_webpage = self._download_webpage(
58 oembed_url, display_id, note='Downloading OEmbed page')
60 ie, video_url = YoutubeIE, YoutubeIE._extract_url(oembed_webpage)
61 if not video_url:
62 ie, video_url = VimeoIE, VimeoIE._extract_url(url, oembed_webpage)
63 if not video_url:
64 raise ExtractorError('No embedded video found')
66 return {
67 '_type': 'url_transparent',
68 'title': self._og_search_title(webpage),
69 'url': video_url,
70 'ie_key': ie.ie_key(),