adobeconnect.py 1.1 KB

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