1 from .common
import InfoExtractor
2 from ..utils
import int_or_none
, merge_dicts
, try_call
, url_basename
5 class DetikEmbedIE(InfoExtractor
):
9 'url': 'https://www.cnnindonesia.com/embed/video/846189',
13 'description': 'md5:ece7b003b3ee7d81c6a5cfede7d5397d',
14 'thumbnail': r
're:https?://akcdn\.detik\.net\.id/visual/2022/09/11/thumbnail-video-1_169.jpeg',
15 'title': 'Video CNN Indonesia - VIDEO: Momen Charles Disambut Meriah usai Dilantik jadi Raja Inggris',
17 'tags': ['raja charles', ' raja charles iii', ' ratu elizabeth', ' ratu elizabeth meninggal dunia', ' raja inggris', ' inggris'],
18 'release_timestamp': 1662869995,
19 'release_date': '20220911',
20 'uploader': 'REUTERS',
24 'url': 'https://20.detik.com/otobuzz/20220704-220704093/mulai-rp-10-jutaan-ini-skema-kredit-mitsubishi-pajero-sport',
26 'display_id': 'mulai-rp-10-jutaan-ini-skema-kredit-mitsubishi-pajero-sport',
29 'description': 'md5:9b2257341b6f375cdcf90106146d5ffb',
30 'thumbnail': r
're:https?://cdnv\.detik\.com/videoservice/AdminTV/2022/07/04/5d6187e402ec4a91877755a5886ff5b6-20220704161859-0s.jpg',
31 'title': 'Mulai Rp 10 Jutaan! Ini Skema Kredit Mitsubishi Pajero Sport',
32 'timestamp': 1656951521,
33 'upload_date': '20220704',
35 'tags': ['cicilan mobil', 'mitsubishi pajero sport', 'mitsubishi', 'pajero sport'],
36 'release_timestamp': 1656926321,
37 'release_date': '20220704',
39 'uploader': 'Ridwan Arifin ', # TODO: strip trailling whitespace at uploader
43 'url': 'https://pasangmata.detik.com/contribution/366649',
47 'title': 'Saling Dorong Aparat dan Pendemo di Aksi Tolak Kenaikan BBM',
48 'description': 'md5:7a6580876c8381c454679e028620bea7',
51 'thumbnail': 'https://akcdn.detik.net.id/community/data/media/thumbs-pasangmata/2022/09/08/366649-16626229351533009620.mp4-03.jpg',
55 'url': 'https://www.insertlive.com/embed/video/290482',
59 'release_timestamp': 1663063704,
60 'thumbnail': 'https://akcdn.detik.net.id/visual/2022/09/13/leonardo-dicaprio_169.png?w=600&q=90',
62 'description': 'Aktor Leonardo DiCaprio memang baru saja putus dari kekasihnya yang bernama Camilla Morrone.',
63 'release_date': '20220913',
64 'title': 'Diincar Leonardo DiCaprio, Gigi Hadid Ngaku Tertarik Tapi Belum Cinta',
65 'tags': ['leonardo dicaprio', ' gigi hadid', ' hollywood'],
66 'uploader': '!nsertlive',
70 'url': 'https://www.beautynesia.id/embed/video/261636',
75 'release_timestamp': 1662375600,
76 'description': 'Menurut ramalan astrologi, tiga zodiak ini bakal hoki sepanjang September 2022.',
77 'title': '3 Zodiak Paling Beruntung Selama September 2022',
78 'release_date': '20220905',
79 'tags': ['zodiac update', ' zodiak', ' ramalan bintang', ' zodiak beruntung 2022', ' zodiak hoki september 2022', ' zodiak beruntung september 2022'],
80 'thumbnail': 'https://akcdn.detik.net.id/visual/2022/09/05/3-zodiak-paling-beruntung-selama-september-2022_169.jpeg?w=600&q=90',
85 'url': 'https://www.cnbcindonesia.com/embed/video/371839',
89 'title': 'Puluhan Pejabat Rusia Tuntut Putin Mundur',
92 'thumbnail': 'https://awsimages.detik.net.id/visual/2022/09/13/cnbc-indonesia-tv-3_169.png?w=600&q=80',
93 'description': 'md5:8b9111e37555fcd95fe549a9b4ae6fdc',
96 # detik shortlink (we can get it from https://dtk.id/?<url>)
97 'url': 'https://dtk.id/NkISKr',
101 'release_timestamp': 1663114488,
102 'uploader': 'Tim 20Detik',
103 'title': 'Pakar Bicara soal Tim Khusus Jokowi dan Mereka yang Pro ke Bjorka',
105 'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/09/14/f15cae71d7b640c58e75b254ecbb1ce1-20220914071613-0s.jpg?w=400&q=80',
106 'display_id': 'pakar-bicara-soal-tim-khusus-jokowi-dan-mereka-yang-pro-ke-bjorka',
107 'upload_date': '20220914',
108 'release_date': '20220914',
109 'description': 'md5:5eb03225f7ee40207dd3a1e18a73f1ff',
110 'timestamp': 1663139688,
112 'tags': ['hacker bjorka', 'bjorka', 'hacker bjorka bocorkan data rahasia presiden jokowi', 'jokowi'],
116 def _extract_from_webpage(self
, url
, webpage
):
117 player_type
, video_data
= self
._search
_regex
(
118 r
'<script\s*[^>]+src="https?://(aws)?cdn\.detik\.net\.id/(?P<type>flowplayer|detikVideo)[^>]+>\s*(?P<video_data>{[^}]+})',
119 webpage
, 'playerjs', group
=('type', 'video_data'), default
=(None, ''))
123 display_id
, extra_info_dict
= url_basename(url
), {}
125 if player_type
== 'flowplayer':
126 video_json_data
= self
._parse
_json
(video_data
.replace('\'', '"'), display_id
)
127 video_url
= video_json_data
['videoUrl']
130 'id': self
._search
_regex
(r
'identifier\s*:\s*\'([^
\']+)', webpage, 'identifier
'),
131 'thumbnail
': video_json_data.get('imageUrl
'),
134 elif player_type == 'detikVideo
':
135 video_url = self._search_regex(
136 r'videoUrl\s
*:\s
*[\'"]?([^"\']+)', video_data, 'videoUrl
')
138 'id': self._html_search_meta(['video_id
', 'dtk
:video_id
'], webpage),
139 'thumbnail
': self._search_regex(r'imageUrl\s
*:\s
*[\'"]?([^"\']+)', video_data, 'videoUrl
'),
140 'duration
': int_or_none(self._html_search_meta('duration
', webpage, fatal=False, default=None)),
141 'release_timestamp
': int_or_none(self._html_search_meta('dtk
:publishdateunix
', webpage, fatal=False, default=None), 1000),
142 'timestamp
': int_or_none(self._html_search_meta('dtk
:createdateunix
', webpage, fatal=False, default=None), 1000),
143 'uploader
': self._search_regex(
144 r'([^
-]+)', self._html_search_meta('dtk
:author
', webpage, default='').strip(), 'uploader
',
148 formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, display_id)
150 json_ld_data = self._search_json_ld(webpage, display_id, default={})
151 yield merge_dicts(json_ld_data, extra_info_dict, {
152 'display_id
': display_id,
153 'title
': self._html_search_meta(['og
:title
', 'originalTitle
'], webpage) or self._html_extract_title(webpage),
154 'description
': self._html_search_meta(['og
:description
', 'twitter
:description
', 'description
'], webpage),
156 'subtitles
': subtitles,
157 'tags
': try_call(lambda: self._html_search_meta(
158 ['keywords
', 'keyword
', 'dtk
:keywords
'], webpage).split(',')),