adobeconnect.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from .common import InfoExtractor
  2. from ..compat import (
  3. compat_parse_qs,
  4. compat_urlparse,
  5. )
  6. class AdobeConnectIE(InfoExtractor):
  7. _VALID_URL = r'https?://\w+\.adobeconnect\.com/(?P<id>[\w-]+)'
  8. def _real_extract(self, url):
  9. video_id = self._match_id(url)
  10. webpage = self._download_webpage(url, video_id)
  11. title = self._html_extract_title(webpage)
  12. qs = compat_parse_qs(self._search_regex(r"swfUrl\s*=\s*'([^']+)'", webpage, 'swf url').split('?')[1])
  13. is_live = qs.get('isLive', ['false'])[0] == 'true'
  14. formats = []
  15. for con_string in qs['conStrings'][0].split(','):
  16. formats.append({
  17. 'format_id': con_string.split('://')[0],
  18. 'app': compat_urlparse.quote('?' + con_string.split('?')[1] + 'flvplayerapp/' + qs['appInstance'][0]),
  19. 'ext': 'flv',
  20. 'play_path': 'mp4:' + qs['streamName'][0],
  21. 'rtmp_conn': 'S:' + qs['ticket'][0],
  22. 'rtmp_live': is_live,
  23. 'url': con_string,
  24. })
  25. return {
  26. 'id': video_id,
  27. 'title': title,
  28. 'formats': formats,
  29. 'is_live': is_live,
  30. }