3 from .common
import InfoExtractor
13 class LikeeIE(InfoExtractor
):
15 _VALID_URL
= r
'(?x)https?://(www\.)?likee\.video/(?:(?P<channel_name>[^/]+)/video/|v/)(?P<id>\w+)'
17 'url': 'https://likee.video/@huynh_hong_quan_/video/7093444807096327263',
19 'id': '7093444807096327263',
22 'description': 'md5:9a7ebe816f0e78722ee5ed76f75983b4',
23 'thumbnail': r
're:^https?://.+\.jpg',
24 'uploader': 'Huỳnh Hồng Quân ',
26 'download_count': int,
27 'artist': 'Huỳnh Hồng Quân ',
28 'timestamp': 1651571320,
29 'upload_date': '20220503',
31 'uploader_id': 'huynh_hong_quan_',
37 'url': 'https://likee.video/@649222262/video/7093167848050058862',
39 'id': '7093167848050058862',
41 'title': 'likee video #7093167848050058862',
42 'description': 'md5:3f971c8c6ee8a216f2b1a9094c5de99f',
43 'thumbnail': r
're:^https?://.+\.jpg',
46 'uploader': 'Vương Phước Nhi',
47 'download_count': int,
48 'timestamp': 1651506835,
49 'upload_date': '20220502',
52 'artist': 'Vương Phước Nhi',
53 'uploader_id': '649222262',
57 'url': 'https://likee.video/@fernanda_rivasg/video/6932224568407629502',
59 'id': '6932224568407629502',
61 'title': 'Un trend viejito🔥 #LIKEE #Ferlovers #trend ',
62 'description': 'md5:c42b903a72a99d6d8b73e3d1126fbcef',
63 'thumbnail': r
're:^https?://.+\.jpg',
66 'uploader_id': 'fernanda_rivasg',
69 'artist': 'La Cami La✨',
70 'download_count': int,
72 'uploader': 'Fernanda Rivas🎶',
73 'timestamp': 1614034308,
74 'upload_date': '20210222',
77 'url': 'https://likee.video/v/k6QcOp',
81 'title': '#AguaChallenge tú ya lo intentaste?😱🤩',
82 'description': 'md5:b0cc462689d4ff2b624daa4dba7640d9',
83 'thumbnail': r
're:^https?://.+\.jpg',
88 'timestamp': 1611694774,
90 'uploader': 'Fernanda Rivas🎶',
91 'uploader_id': 'fernanda_rivasg',
92 'download_count': int,
93 'artist': 'ʟᴇʀɪᴋ_ᴜɴɪᴄᴏʀɴ♡︎',
94 'upload_date': '20210126',
97 'url': 'https://www.likee.video/@649222262/video/7093167848050058862',
98 'only_matching': True,
100 'url': 'https://www.likee.video/v/k6QcOp',
101 'only_matching': True,
104 def _real_extract(self
, url
):
105 video_id
= self
._match
_id
(url
)
106 webpage
= self
._download
_webpage
(url
, video_id
)
107 info
= self
._parse
_json
(
108 self
._search
_regex
(r
'window\.data\s=\s({.+?});', webpage
, 'video info'),
109 video_id
, transform_source
=js_to_json
)
110 video_url
= traverse_obj(info
, 'video_url', ('originVideoInfo', 'video_url'))
112 self
.raise_no_formats('Video was deleted', expected
=True)
114 'format_id': 'mp4-with-watermark',
116 'height': info
.get('video_height'),
117 'width': info
.get('video_width'),
119 'format_id': 'mp4-without-watermark',
120 'url': video_url
.replace('_4', ''),
121 'height': info
.get('video_height'),
122 'width': info
.get('video_width'),
125 self
._sort
_formats
(formats
)
128 'title': info
.get('msgText'),
129 'description': info
.get('share_desc'),
130 'view_count': int_or_none(info
.get('video_count')),
131 'like_count': int_or_none(info
.get('likeCount')),
132 'play_count': int_or_none(info
.get('play_count')),
133 'download_count': int_or_none(info
.get('download_count')),
134 'comment_count': int_or_none(info
.get('comment_count')),
135 'uploader': str_or_none(info
.get('nick_name')),
136 'uploader_id': str_or_none(info
.get('likeeId')),
137 'artist': str_or_none(traverse_obj(info
, ('sound', 'owner_name'))),
138 'timestamp': parse_iso8601(info
.get('uploadDate')),
139 'thumbnail': info
.get('coverUrl'),
140 'duration': int_or_none(traverse_obj(info
, ('option_data', 'dur'))),
145 class LikeeUserIE(InfoExtractor
):
146 IE_NAME
= 'likee:user'
147 _VALID_URL
= r
'https?://(www\.)?likee\.video/(?P<id>[^/]+)/?$'
149 'url': 'https://likee.video/@fernanda_rivasg',
152 'title': 'fernanda_rivasg',
154 'playlist_mincount': 500,
156 'url': 'https://likee.video/@may_hmoob',
159 'title': 'may_hmoob',
161 'playlist_mincount': 80,
164 _API_GET_USER_VIDEO
= 'https://api.like-video.com/likee-activity-flow-micro/videoApi/getUserVideo'
166 def _entries(self
, user_name
, user_id
):
169 user_videos
= self
._download
_json
(
170 self
._API
_GET
_USER
_VIDEO
, user_name
,
173 'count': self
._PAGE
_SIZE
,
174 'lastPostId': last_post_id
,
177 headers
={'content-type': 'application/json'}
,
178 note
=f
'Get user info with lastPostId #{last_post_id}')
179 items
= traverse_obj(user_videos
, ('data', 'videoList'))
183 last_post_id
= item
['postId']
184 yield self
.url_result(f
'https://likee.video/{user_name}/video/{last_post_id}')
186 def _real_extract(self
, url
):
187 user_name
= self
._match
_id
(url
)
188 webpage
= self
._download
_webpage
(url
, user_name
)
189 info
= self
._parse
_json
(
190 self
._search
_regex
(r
'window\.data\s*=\s*({.+?});', webpage
, 'user info'),
191 user_name
, transform_source
=js_to_json
)
192 user_id
= traverse_obj(info
, ('userinfo', 'uid'))
193 return self
.playlist_result(self
._entries
(user_name
, user_id
), user_id
, traverse_obj(info
, ('userinfo', 'user_name')))