3 from .common
import InfoExtractor
, SearchInfoExtractor
4 from .dailymotion
import DailymotionIE
5 from ..utils
import smuggle_url
, traverse_obj
8 class NetverseBaseIE(InfoExtractor
):
10 'watch': 'watchvideo',
11 'video': 'watchvideo',
12 'webseries': 'webseries',
13 'season': 'webseason_videos',
16 def _call_api(self
, slug
, endpoint
, query
={}, season_id
='', display_id
=None):
17 return self
._download
_json
(
18 f
'https://api.netverse.id/medias/api/v2/{self._ENDPOINTS[endpoint]}/{slug}/{season_id}',
19 display_id
or slug
, query
=query
)
21 def _get_comments(self
, video_id
):
22 last_page_number
= None
23 for i
in itertools
.count(1):
24 comment_data
= self
._download
_json
(
25 f
'https://api.netverse.id/mediadetails/api/v3/videos/comments/{video_id}',
26 video_id
, data
=b
'', fatal
=False, query
={'page': i
},
27 note
=f
'Downloading JSON comment metadata page {i}') or {}
28 yield from traverse_obj(comment_data
, ('response', 'comments', 'data', ..., {
31 'author_id': 'customer_id',
32 'author': ('customer', 'name'),
33 'author_thumbnail': ('customer', 'profile_picture'),
36 if not last_page_number
:
37 last_page_number
= traverse_obj(comment_data
, ('response', 'comments', 'last_page'))
38 if i
>= (last_page_number
or 0):
42 class NetverseIE(NetverseBaseIE
):
43 _VALID_URL
= r
'https?://(?:\w+\.)?netverse\.id/(?P<type>watch|video)/(?P<display_id>[^/?#&]+)'
46 'url': 'https://www.netverse.id/watch/waktu-indonesia-bercanda-edisi-spesial-lebaran-2016',
48 'id': 'k4yhqUwINAGtmHx3NkL',
49 'title': 'Waktu Indonesia Bercanda - Edisi Spesial Lebaran 2016',
51 'season': 'Season 2016',
52 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
53 'thumbnail': r
're:https?://s\d+\.dmcdn\.net/v/[^/]+/x1080',
55 'episode': 'Episode 22',
56 'uploader_id': 'x2ir3vq',
60 'display_id': 'waktu-indonesia-bercanda-edisi-spesial-lebaran-2016',
62 'upload_date': '20210722',
63 'timestamp': 1626919804,
65 'uploader': 'Net Prime',
69 'url': 'https://www.netverse.id/watch/jadoo-seorang-model',
72 'title': 'Jadoo Seorang Model',
75 'description': 'md5:8a74f70812cca267e19ee0635f0af835',
76 'thumbnail': r
're:https?://s\d+\.dmcdn\.net/v/[^/]+/x1080',
78 'episode': 'Episode 2',
81 'display_id': 'jadoo-seorang-model',
82 'uploader_id': 'x2ir3vq',
84 'timestamp': 1646372927,
85 'tags': ['PG069497-hellojadooseason2eps2'],
86 'upload_date': '20220304',
87 'uploader': 'Net Prime',
90 'skip': 'video get Geo-blocked for some country',
93 'url': 'https://netverse.id/watch/tetangga-baru',
95 'id': 'k4CNGz7V0HJ7vfwZbXy',
97 'title': 'Tetangga Baru',
99 'description': 'md5:23fcf70e97d461d3029d25d59b2ccfb9',
100 'thumbnail': r
're:https?://s\d+\.dmcdn\.net/v/[^/]+/x1080',
102 'episode': 'Episode 1',
103 'timestamp': 1624538169,
105 'upload_date': '20210624',
107 'uploader_id': 'x2ir3vq',
109 'uploader': 'Net Prime',
110 'tags': ['PG008534', 'tetangga', 'Baru'],
111 'display_id': 'tetangga-baru',
116 'url': 'https://www.netverse.id/video/pg067482-hellojadoo-season1',
117 'title': 'Namaku Choi Jadoo',
121 'thumbnail': r
're:https?://s\d+\.dmcdn\.net/v/[^/]+/x1080',
122 'season': 'Season 1',
124 'description': 'md5:d4f627b3e7a3f9acdc55f6cdd5ea41d5',
125 'title': 'Namaku Choi Jadoo',
126 'episode': 'Episode 1',
130 'tags': ['PG067482', 'PG067482-HelloJadoo-season1'],
132 'display_id': 'pg067482-hellojadoo-season1',
133 'uploader_id': 'x2ir3vq',
134 'uploader': 'Net Prime',
135 'timestamp': 1645764984,
136 'upload_date': '20220225',
138 'skip': 'This video get Geo-blocked for some country',
140 # video with comments
141 'url': 'https://netverse.id/video/episode-1-season-2016-ok-food',
143 'id': 'k6hetBPiQMljSxxvAy7',
145 'thumbnail': r
're:https?://s\d+\.dmcdn\.net/v/[^/]+/x1080',
146 'display_id': 'episode-1-season-2016-ok-food',
151 'timestamp': 1642405848,
153 'season': 'Season 2016',
154 'uploader_id': 'x2ir3vq',
155 'title': 'Episode 1 - Season 2016 - Ok Food',
156 'upload_date': '20220117',
159 'episode': 'Episode 1',
160 'uploader': 'Net Prime',
161 'comment_count': int,
167 # video with multiple page comment
168 'url': 'https://netverse.id/video/match-island-eps-1-fix',
173 'tags': ['Match-Island', 'Pd00111'],
174 'display_id': 'match-island-eps-1-fix',
176 'episode': 'Episode 1',
177 'uploader': 'Net Prime',
179 'timestamp': 1653068165,
180 'description': 'md5:e9cf3b480ad18e9c33b999e3494f223f',
182 'title': 'Welcome To Match Island',
183 'upload_date': '20220520',
185 'thumbnail': r
're:https?://s\d+\.dmcdn\.net/v/[^/]+/x1080',
186 'uploader_id': 'x2ir3vq',
187 'season': 'Season 1',
188 'comment_count': int,
195 def _real_extract(self
, url
):
196 display_id
, sites_type
= self
._match
_valid
_url
(url
).group('display_id', 'type')
197 program_json
= self
._call
_api
(display_id
, sites_type
)
198 videos
= program_json
['response']['videos']
201 '_type': 'url_transparent',
202 'ie_key': DailymotionIE
.ie_key(),
203 'url': smuggle_url(videos
['dailymotion_url'], {'query': {'embedder': 'https://www.netverse.id'}}),
204 'display_id': display_id
,
205 'title': videos
.get('title'),
206 'season': videos
.get('season_name'),
207 'thumbnail': traverse_obj(videos
, ('program_detail', 'thumbnail_image')),
208 'description': traverse_obj(videos
, ('program_detail', 'description')),
209 'episode_number': videos
.get('episode_order'),
210 '__post_extractor': self
.extract_comments(display_id
),
214 class NetversePlaylistIE(NetverseBaseIE
):
215 _VALID_URL
= r
'https?://(?:\w+\.)?netverse\.id/(?P<type>webseries)/(?P<display_id>[^/?#&]+)'
218 'url': 'https://netverse.id/webseries/tetangga-masa-gitu',
220 'id': 'tetangga-masa-gitu',
221 'title': 'Tetangga Masa Gitu',
223 'playlist_count': 519,
226 'url': 'https://netverse.id/webseries/kelas-internasional',
228 'id': 'kelas-internasional',
229 'title': 'Kelas Internasional',
231 'playlist_count': 203,
234 def parse_playlist(self
, json_data
, playlist_id
):
235 slug_sample
= traverse_obj(json_data
, ('related', 'data', ..., 'slug'))[0]
236 for season
in traverse_obj(json_data
, ('seasons', ..., 'id')):
237 playlist_json
= self
._call
_api
(
238 slug_sample
, 'season', display_id
=playlist_id
, season_id
=season
)
240 for current_page
in range(playlist_json
['response']['season_list']['last_page']):
241 playlist_json
= self
._call
_api
(slug_sample
, 'season', query
={'page': current_page
+ 1},
242 season_id
=season
, display_id
=playlist_id
)
243 for slug
in traverse_obj(playlist_json
, ('response', ..., 'data', ..., 'slug')):
244 yield self
.url_result(f
'https://www.netverse.id/video/{slug}', NetverseIE
)
246 def _real_extract(self
, url
):
247 playlist_id
, sites_type
= self
._match
_valid
_url
(url
).group('display_id', 'type')
248 playlist_data
= self
._call
_api
(playlist_id
, sites_type
)
250 return self
.playlist_result(
251 self
.parse_playlist(playlist_data
['response'], playlist_id
),
252 traverse_obj(playlist_data
, ('response', 'webseries_info', 'slug')),
253 traverse_obj(playlist_data
, ('response', 'webseries_info', 'title')))
256 class NetverseSearchIE(SearchInfoExtractor
):
257 _SEARCH_KEY
= 'netsearch'
260 'url': 'netsearch10:tetangga',
265 'playlist_count': 10,
268 def _search_results(self
, query
):
270 for i
in itertools
.count(1):
271 search_data
= self
._download
_json
(
272 'https://api.netverse.id/search/elastic/search', query
,
273 query
={'q': query
, 'page': i
}, note
=f
'Downloading page {i}')
275 videos
= traverse_obj(search_data
, ('response', 'data', ...))
277 yield self
.url_result(f
'https://netverse.id/video/{video["slug"]}', NetverseIE
)
279 last_page
= last_page
or traverse_obj(search_data
, ('response', 'lastpage'))
280 if not videos
or i
>= (last_page
or 0):