screencastomatic.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .jwplatform import JWPlatformBaseIE
  4. from ..utils import js_to_json
  5. class ScreencastOMaticIE(JWPlatformBaseIE):
  6. _VALID_URL = r'https?://screencast-o-matic\.com/watch/(?P<id>[0-9a-zA-Z]+)'
  7. _TEST = {
  8. 'url': 'http://screencast-o-matic.com/watch/c2lD3BeOPl',
  9. 'md5': '483583cb80d92588f15ccbedd90f0c18',
  10. 'info_dict': {
  11. 'id': 'c2lD3BeOPl',
  12. 'ext': 'mp4',
  13. 'title': 'Welcome to 3-4 Philosophy @ DECV!',
  14. 'thumbnail': 're:^https?://.*\.jpg$',
  15. 'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
  16. }
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. jwplayer_data = self._parse_json(
  22. self._search_regex(
  23. r"(?s)jwplayer\('mp4Player'\).setup\((\{.*?\})\);", webpage, 'setup code'),
  24. video_id, transform_source=js_to_json)
  25. info_dict = self._parse_jwplayer_data(jwplayer_data, video_id, require_title=False)
  26. info_dict.update({
  27. 'title': self._og_search_title(webpage),
  28. 'description': self._og_search_description(webpage),
  29. })
  30. return info_dict