]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/adobeconnect.py
Update README.md
[youtubedl] / youtube_dl / extractor / adobeconnect.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..compat import (
6 compat_parse_qs,
7 compat_urlparse,
8 )
9
10
11 class AdobeConnectIE(InfoExtractor):
12 _VALID_URL = r'https?://\w+\.adobeconnect\.com/(?P<id>[\w-]+)'
13
14 def _real_extract(self, url):
15 video_id = self._match_id(url)
16 webpage = self._download_webpage(url, video_id)
17 title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
18 qs = compat_parse_qs(self._search_regex(r"swfUrl\s*=\s*'([^']+)'", webpage, 'swf url').split('?')[1])
19 is_live = qs.get('isLive', ['false'])[0] == 'true'
20 formats = []
21 for con_string in qs['conStrings'][0].split(','):
22 formats.append({
23 'format_id': con_string.split('://')[0],
24 'app': compat_urlparse.quote('?' + con_string.split('?')[1] + 'flvplayerapp/' + qs['appInstance'][0]),
25 'ext': 'flv',
26 'play_path': 'mp4:' + qs['streamName'][0],
27 'rtmp_conn': 'S:' + qs['ticket'][0],
28 'rtmp_live': is_live,
29 'url': con_string,
30 })
31
32 return {
33 'id': video_id,
34 'title': self._live_title(title) if is_live else title,
35 'formats': formats,
36 'is_live': is_live,
37 }