]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/telemb.py
[ie/youtube] Suppress "Unavailable videos are hidden" warning (#10159)
[yt-dlp.git] / yt_dlp / extractor / telemb.py
CommitLineData
09334400 1import re
09334400 2
adf2c098
S
3from .common import InfoExtractor
4from ..utils import remove_start
09334400 5
09334400 6
adf2c098 7class TeleMBIE(InfoExtractor):
df773c3d 8 _WORKING = False
adf2c098
S
9 _VALID_URL = r'https?://(?:www\.)?telemb\.be/(?P<display_id>.+?)_d_(?P<id>\d+)\.html'
10 _TESTS = [
11 {
12 'url': 'http://www.telemb.be/mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-_d_13466.html',
13 'md5': 'f45ea69878516ba039835794e0f8f783',
14 'info_dict': {
15 'id': '13466',
16 'display_id': 'mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-',
17 'ext': 'mp4',
18 'title': 'Mons - Cook with Danielle : des cours de cuisine en anglais ! - Les reportages',
19 'description': 'md5:bc5225f47b17c309761c856ad4776265',
ec85ded8 20 'thumbnail': r're:^http://.*\.(?:jpg|png)$',
add96eb9 21 },
adf2c098
S
22 },
23 {
f24e740b 24 # non-ASCII characters in download URL
adf2c098
S
25 'url': 'http://telemb.be/les-reportages-havre-incendie-mortel_d_13514.html',
26 'md5': '6e9682736e5ccd4eab7f21e855350733',
27 'info_dict': {
28 'id': '13514',
29 'display_id': 'les-reportages-havre-incendie-mortel',
30 'ext': 'mp4',
31 'title': 'Havré - Incendie mortel - Les reportages',
32 'description': 'md5:5e54cb449acb029c2b7734e2d946bd4a',
ec85ded8 33 'thumbnail': r're:^http://.*\.(?:jpg|png)$',
add96eb9 34 },
adf2c098
S
35 },
36 ]
09334400
L
37
38 def _real_extract(self, url):
5ad28e7f 39 mobj = self._match_valid_url(url)
09334400 40 video_id = mobj.group('id')
adf2c098 41 display_id = mobj.group('display_id')
09334400 42
adf2c098 43 webpage = self._download_webpage(url, display_id)
09334400 44
adf2c098
S
45 formats = []
46 for video_url in re.findall(r'file\s*:\s*"([^"]+)"', webpage):
47 fmt = {
48 'url': video_url,
add96eb9 49 'format_id': video_url.split(':')[0],
adf2c098
S
50 }
51 rtmp = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>.+))/(?P<playpath>mp4:.+)$', video_url)
52 if rtmp:
53 fmt.update({
54 'play_path': rtmp.group('playpath'),
55 'app': rtmp.group('app'),
56 'player_url': 'http://p.jwpcdn.com/6/10/jwplayer.flash.swf',
57 'page_url': 'http://www.telemb.be',
f983b875 58 'preference': -10,
adf2c098
S
59 })
60 formats.append(fmt)
09334400 61
adf2c098
S
62 title = remove_start(self._og_search_title(webpage), 'TéléMB : ')
63 description = self._html_search_regex(
64 r'<meta property="og:description" content="(.+?)" />',
65 webpage, 'description', fatal=False)
66 thumbnail = self._og_search_thumbnail(webpage)
09334400 67
adf2c098
S
68 return {
69 'id': video_id,
70 'display_id': display_id,
71 'title': title,
72 'description': description,
73 'thumbnail': thumbnail,
74 'formats': formats,
75 }