1 from .common
import InfoExtractor
2 from ..networking
.exceptions
import HTTPError
14 class TrueIDIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?P<domain>vn\.trueid\.net|trueid\.(?:id|ph))/(?:movie|series/[^/]+)/(?P<id>[^/?#&]+)'
17 'url': 'https://trueid.id/movie/XYNlDOZZJzL6/pengabdi-setan/',
18 'md5': '2552c7535125885901f1a2a4bcf32ca3',
22 'title': 'Pengabdi Setan',
23 'display_id': 'pengabdi-setan',
24 'description': 'md5:b0b41df08601e85e5291496c9bbe52cd',
25 'timestamp': 1600243511,
26 'categories': ['Film Indonesia', 'Horror', 'Mystery'],
27 'release_timestamp': 1593536400,
30 'thumbnail': 'https://cms.dmpcdn.com/movie/2020/09/18/8b6e35c0-f97f-11ea-81fe-c52fc9dd314f_original.png',
31 'upload_date': '20200916',
32 'release_date': '20200630',
34 'expected_warnings': ['Video is geo restricted.'],
36 'url': 'https://trueid.id/series/zZOBVPb62EwR/qXY73rwyl7oj/one-piece-ep-1/',
37 'md5': '1c6d976049bc3c89a8a25aed2c3fb081',
41 'title': 'One Piece Ep. 1',
42 'display_id': 'one-piece-ep-1',
43 'description': 'md5:13226d603bd03c4150a1cf5758e842ea',
44 'timestamp': 1610421085,
45 'categories': ['Animation & Cartoon', 'Kids & Family', 'Adventure'],
46 'release_timestamp': 1612112400,
49 'cast': ['Kounosuke Uda', 'Junji Shimizu'],
50 'thumbnail': 'https://cms.dmpcdn.com/movie/2021/01/13/f84e9e70-5562-11eb-9fe2-dd6c2099a468_original.png',
51 'upload_date': '20210112',
52 'release_date': '20210131',
54 'expected_warnings': ['Video is geo restricted.'],
56 'url': 'https://vn.trueid.net/series/7DNPM7Bpa9wv/pwLgEQ4Xbda2/haikyu-vua-bong-chuyen-phan-1/',
60 'title': 'Haikyu!!: Vua Bóng Chuyền Phần 1 - Tập 1',
61 'display_id': 'haikyu-vua-bong-chuyen-phan-1-tap-1',
62 'description': 'md5:0374dd44d247799169449ee30cca963a',
63 'timestamp': 1629270901,
64 'categories': ['Anime', 'Phim Hài', 'Phim Học Đường', 'Phim Thể Thao', 'Shounen'],
65 'release_timestamp': 1629270720,
68 'thumbnail': 'https://cms.dmpcdn.com/movie/2021/09/28/b6e7ec00-2039-11ec-8436-974544e5841f_webp_original.jpg',
69 'upload_date': '20210818',
70 'release_date': '20210818',
72 'expected_warnings': ['Video is geo restricted.'],
74 'url': 'https://trueid.ph/series/l8rvvAw7Jwv8/l8rvvAw7Jwv8/naruto-trailer/',
75 'only_matching': True,
81 def _real_extract(self
, url
):
82 domain
, video_id
= self
._match
_valid
_url
(url
).group('domain', 'id')
83 webpage
= self
._download
_webpage
(url
, video_id
)
84 initial_data
= traverse_obj(
85 self
._search
_nextjs
_data
(webpage
, video_id
, fatal
=False), ('props', 'pageProps', 'initialContentData'), default
={})
88 stream_data
= self
._download
_json
(
89 f
'https://{domain}/cmsPostProxy/contents/video/{video_id}/streamer?os=android', video_id
, data
=b
'')['data']
90 except ExtractorError
as e
:
91 if not isinstance(e
.cause
, HTTPError
):
93 errmsg
= self
._parse
_json
(e
.cause
.response
.read().decode(), video_id
)['meta']['message']
94 if 'country' in errmsg
:
95 self
.raise_geo_restricted(
96 errmsg
, [initial_data
['display_country']] if initial_data
.get('display_country') else None, True)
98 self
.raise_no_formats(errmsg
, video_id
=video_id
)
101 stream_url
= stream_data
['stream']['stream_url']
102 stream_ext
= determine_ext(stream_url
)
103 if stream_ext
== 'm3u8':
104 formats
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(stream_url
, video_id
, 'mp4')
105 elif stream_ext
== 'mpd':
106 formats
, subs
= self
._extract
_mpd
_formats
_and
_subtitles
(stream_url
, video_id
)
108 formats
= [{'url': stream_url
}]
111 {'id': thumb_key
, 'url': thumb_url
}
112 for thumb_key
, thumb_url
in (initial_data
.get('thumb_list') or {}).items()
113 if url_or_none(thumb_url
)]
117 'title': initial_data
.get('title') or self
._html
_search
_regex
(
118 [r
'Nonton (?P<name>.+) Gratis',
119 r
'Xem (?P<name>.+) Miễn phí',
120 r
'Watch (?P<name>.+) Free'], webpage
, 'title', group
='name'),
121 'display_id': initial_data
.get('slug_title'),
122 'description': initial_data
.get('synopsis'),
123 'timestamp': unified_timestamp(initial_data
.get('create_date')),
124 # 'duration': int_or_none(initial_data.get('duration'), invscale=60), # duration field must atleast be accurate to the second
125 'categories': traverse_obj(initial_data
, ('article_category_details', ..., 'name')),
126 'release_timestamp': unified_timestamp(initial_data
.get('publish_date')),
127 'release_year': int_or_none(initial_data
.get('release_year')),
130 'thumbnails': thumbnails
,
131 'age_limit': self
._CUSTOM
_RATINGS
.get(initial_data
.get('rate')) or parse_age_limit(initial_data
.get('rate')),
132 'cast': traverse_obj(initial_data
, (('actor', 'director'), ...)),
133 'view_count': int_or_none(initial_data
.get('count_views')),
134 'like_count': int_or_none(initial_data
.get('count_likes')),
135 'average_rating': int_or_none(initial_data
.get('count_ratings')),