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.

52 lines
1.5 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class WayOfTheMasterIE(InfoExtractor):
  5. _VALID_URL = r'https?://www\.wayofthemaster\.com/([^/?#]*/)*(?P<id>[^/?#]+)\.s?html(?:$|[?#])'
  6. _TEST = {
  7. 'url': 'http://www.wayofthemaster.com/hbks.shtml',
  8. 'md5': '5316b57487ada8480606a93cb3d18d24',
  9. 'info_dict': {
  10. 'id': 'hbks',
  11. 'ext': 'mp4',
  12. 'title': 'Intelligent Design vs. Evolution',
  13. },
  14. }
  15. def _real_extract(self, url):
  16. mobj = re.match(self._VALID_URL, url)
  17. video_id = mobj.group('id')
  18. webpage = self._download_webpage(url, video_id)
  19. title = self._search_regex(
  20. r'<img src="images/title_[^"]+".*?alt="([^"]+)"',
  21. webpage, 'title', default=None)
  22. if title is None:
  23. title = self._html_search_regex(
  24. r'<title>(.*?)</title>', webpage, 'page title')
  25. url_base = self._search_regex(
  26. r'<param\s+name="?movie"?\s+value=".*?/wotm_videoplayer_highlow[0-9]*\.swf\?vid=([^"]+)"',
  27. webpage, 'URL base')
  28. formats = [{
  29. 'format_id': 'low',
  30. 'quality': 1,
  31. 'url': url_base + '_low.mp4',
  32. }, {
  33. 'format_id': 'high',
  34. 'quality': 2,
  35. 'url': url_base + '_high.mp4',
  36. }]
  37. self._sort_formats(formats)
  38. return {
  39. 'id': video_id,
  40. 'title': title,
  41. 'formats': formats,
  42. }