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.

35 lines
1.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class JWPlatformIE(InfoExtractor):
  6. _VALID_URL = r'(?:https?://content\.jwplatform\.com/(?:feeds|players|jw6)/|jwplatform:)(?P<id>[a-zA-Z0-9]{8})'
  7. _TEST = {
  8. 'url': 'http://content.jwplatform.com/players/nPripu9l-ALJ3XQCI.js',
  9. 'md5': 'fa8899fa601eb7c83a64e9d568bdf325',
  10. 'info_dict': {
  11. 'id': 'nPripu9l',
  12. 'ext': 'mov',
  13. 'title': 'Big Buck Bunny Trailer',
  14. 'description': 'Big Buck Bunny is a short animated film by the Blender Institute. It is made using free and open source software.',
  15. 'upload_date': '20081127',
  16. 'timestamp': 1227796140,
  17. }
  18. }
  19. @staticmethod
  20. def _extract_url(webpage):
  21. mobj = re.search(
  22. r'<script[^>]+?src=["\'](?P<url>(?:https?:)?//content.jwplatform.com/players/[a-zA-Z0-9]{8})',
  23. webpage)
  24. if mobj:
  25. return mobj.group('url')
  26. def _real_extract(self, url):
  27. video_id = self._match_id(url)
  28. json_data = self._download_json('http://content.jwplatform.com/feeds/%s.json' % video_id, video_id)
  29. return self._parse_jwplayer_data(json_data, video_id)