1 from .common
import InfoExtractor
2 from ..utils
import int_or_none
5 class TwentyThreeVideoIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://(?P<domain>[^.]+\.(?:twentythree\.net|23video\.com|filmweb\.no))/v\.ihtml/player\.html\?(?P<query>.*?\bphoto(?:_|%5f)id=(?P<id>\d+).*)'
9 'url': 'https://video.twentythree.net/v.ihtml/player.html?showDescriptions=0&source=site&photo%5fid=20448876&autoPlay=1',
10 'md5': '75fcf216303eb1dae9920d651f85ced4',
14 'title': 'Video Marketing Minute: Personalized Video',
15 'timestamp': 1513855354,
16 'upload_date': '20171221',
17 'uploader_id': '12258964',
18 'uploader': 'Rasmus Bysted',
21 'url': 'https://bonnier-publications-danmark.23video.com/v.ihtml/player.html?token=f0dc46476e06e13afd5a1f84a29e31e8&source=embed&photo%5fid=36137620',
22 'only_matching': True,
25 def _real_extract(self
, url
):
26 domain
, query
, photo_id
= self
._match
_valid
_url
(url
).groups()
27 base_url
= f
'https://{domain}'
28 photo_data
= self
._download
_json
(
29 base_url
+ '/api/photo/list?' + query
, photo_id
, query
={
31 }, transform_source
=lambda s
: self
._search
_regex
(r
'(?s)({.+})', s
, 'photo data'))['photo']
32 title
= photo_data
['title']
36 audio_path
= photo_data
.get('audio_download')
40 'url': base_url
+ audio_path
,
41 'filesize': int_or_none(photo_data
.get('audio_size')),
45 def add_common_info_to_list(l
, template
, id_field
, id_value
):
46 f_base
= template
% id_value
47 f_path
= photo_data
.get(f_base
+ 'download')
52 'url': base_url
+ f_path
,
53 'width': int_or_none(photo_data
.get(f_base
+ 'width')),
54 'height': int_or_none(photo_data
.get(f_base
+ 'height')),
55 'filesize': int_or_none(photo_data
.get(f_base
+ 'size')),
58 for f
in ('mobile_high', 'medium', 'hd', '1080p', '4k'):
59 add_common_info_to_list(formats
, 'video_%s_', 'format_id', f
)
62 for t
in ('quad16', 'quad50', 'quad75', 'quad100', 'small', 'portrait', 'standard', 'medium', 'large', 'original'):
63 add_common_info_to_list(thumbnails
, '%s_', 'id', t
)
68 'timestamp': int_or_none(photo_data
.get('creation_date_epoch')),
69 'duration': int_or_none(photo_data
.get('video_length')),
70 'view_count': int_or_none(photo_data
.get('view_count')),
71 'comment_count': int_or_none(photo_data
.get('number_of_comments')),
72 'uploader_id': photo_data
.get('user_id'),
73 'uploader': photo_data
.get('display_name'),
74 'thumbnails': thumbnails
,