You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB

  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': r're:^https?://.*\.jpg$',
  15. 'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
  16. 'duration': 369.163,
  17. }
  18. }
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(url, video_id)
  22. jwplayer_data = self._parse_json(
  23. self._search_regex(
  24. r"(?s)jwplayer\('mp4Player'\).setup\((\{.*?\})\);", webpage, 'setup code'),
  25. video_id, transform_source=js_to_json)
  26. info_dict = self._parse_jwplayer_data(jwplayer_data, video_id, require_title=False)
  27. info_dict.update({
  28. 'title': self._og_search_title(webpage),
  29. 'description': self._og_search_description(webpage),
  30. })
  31. return info_dict