Skip to content

Commit b8b3f45

Browse files
[Odnoklassniki] Improve embedded players extraction (yt-dlp#2549)
Authored by: KiberInfinity
1 parent 1c6f480 commit b8b3f45

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

yt_dlp/extractor/odnoklassniki.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,38 @@ class OdnoklassnikiIE(InfoExtractor):
3535
(?P<id>[\d-]+)
3636
'''
3737
_TESTS = [{
38+
'note': 'Coub embedded',
39+
'url': 'http://ok.ru/video/1484130554189',
40+
'info_dict': {
41+
'id': '1keok9',
42+
'ext': 'mp4',
43+
'timestamp': 1545580896,
44+
'view_count': int,
45+
'thumbnail': 'https://coub-anubis-a.akamaized.net/coub_storage/coub/simple/cw_image/c5ac87553bd/608e806a1239c210ab692/1545580913_00026.jpg',
46+
'title': 'Народная забава',
47+
'uploader': 'Nevata',
48+
'upload_date': '20181223',
49+
'age_limit': 0,
50+
'uploader_id': 'nevata.s',
51+
'like_count': int,
52+
'duration': 8.08,
53+
'repost_count': int,
54+
},
55+
}, {
56+
'note': 'vk.com embedded',
57+
'url': 'https://ok.ru/video/3568183087575',
58+
'info_dict': {
59+
'id': '-165101755_456243749',
60+
'ext': 'mp4',
61+
'uploader_id': '-165101755',
62+
'duration': 132,
63+
'timestamp': 1642869935,
64+
'upload_date': '20220122',
65+
'thumbnail': str,
66+
'title': str,
67+
'uploader': str,
68+
},
69+
}, {
3870
# metadata in JSON
3971
'url': 'http://ok.ru/video/20079905452',
4072
'md5': '0b62089b479e06681abaaca9d204f152',
@@ -171,6 +203,10 @@ def _extract_desktop(self, url):
171203
webpage, 'player', group='player')),
172204
video_id)
173205

206+
# embedded external player
207+
if player.get('isExternalPlayer') and player.get('url'):
208+
return self.url_result(player['url'])
209+
174210
flashvars = player['flashvars']
175211

176212
metadata = flashvars.get('metadata')
@@ -226,6 +262,14 @@ def _extract_desktop(self, url):
226262
'start_time': start_time,
227263
}
228264

265+
# pladform
266+
if provider == 'OPEN_GRAPH':
267+
info.update({
268+
'_type': 'url_transparent',
269+
'url': movie['contentId'],
270+
})
271+
return info
272+
229273
if provider == 'USER_YOUTUBE':
230274
info.update({
231275
'_type': 'url_transparent',

0 commit comments

Comments
 (0)