]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ooyala.py
d08e47734c217864a93062acbe87e2e658c57779
4 from .common
import InfoExtractor
5 from ..utils
import unescapeHTML
7 class OoyalaIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://.+?\.ooyala\.com/.*?embedCode=(?P<id>.+?)(&|$)'
11 # From http://it.slashdot.org/story/13/04/25/178216/recovering-data-from-broken-hard-drives-and-ssds-video
12 u
'url': u
'http://player.ooyala.com/player.js?embedCode=pxczE2YjpfHfn1f3M-ykG_AmJRRn0PD8',
13 u
'file': u
'pxczE2YjpfHfn1f3M-ykG_AmJRRn0PD8.mp4',
14 u
'md5': u
'3f5cceb3a7bf461d6c29dc466cf8033c',
16 u
'title': u
'Explaining Data Recovery from Hard Drives and SSDs',
17 u
'description': u
'How badly damaged does a drive have to be to defeat Russell and his crew? Apparently, smashed to bits.',
22 def _url_for_embed_code(embed_code
):
23 return 'http://player.ooyala.com/player.js?embedCode=%s' % embed_code
26 def _build_url_result(cls
, embed_code
):
27 return cls
.url_result(cls
._url
_for
_embed
_code
(embed_code
),
30 def _extract_result(self
, info
, more_info
):
31 return {'id': info
['embedCode'],
33 'title': unescapeHTML(info
['title']),
34 'url': info
.get('ipad_url') or info
['url'],
35 'description': unescapeHTML(more_info
['description']),
36 'thumbnail': more_info
['promo'],
39 def _real_extract(self
, url
):
40 mobj
= re
.match(self
._VALID
_URL
, url
)
41 embedCode
= mobj
.group('id')
42 player_url
= 'http://player.ooyala.com/player.js?embedCode=%s' % embedCode
43 player
= self
._download
_webpage
(player_url
, embedCode
)
44 mobile_url
= self
._search
_regex
(r
'mobile_player_url="(.+?)&device="',
45 player
, u
'mobile player url')
46 mobile_player
= self
._download
_webpage
(mobile_url
, embedCode
)
47 videos_info
= self
._search
_regex
(
48 r
'var streams=window.oo_testEnv\?\[\]:eval\("\((\[{.*?}\])\)"\);',
49 mobile_player
, u
'info').replace('\\"','"')
50 videos_more_info
= self
._search
_regex
(r
'eval\("\(({.*?\\"promo\\".*?})\)"', mobile_player
, u
'more info').replace('\\"','"')
51 videos_info
= json
.loads(videos_info
)
52 videos_more_info
=json
.loads(videos_more_info
)
54 if videos_more_info
.get('lineup'):
55 videos
= [self
._extract
_result
(info
, more_info
) for (info
, more_info
) in zip(videos_info
, videos_more_info
['lineup'])]
56 return {'_type': 'playlist',
58 'title': unescapeHTML(videos_more_info
['title']),
62 return self
._extract
_result
(videos_info
[0], videos_more_info
)