oneplace.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from .common import InfoExtractor
  2. class OnePlacePodcastIE(InfoExtractor):
  3. _VALID_URL = r'https?://www\.oneplace\.com/[\w]+/[^/]+/listen/[\w-]+-(?P<id>\d+)'
  4. _TESTS = [{
  5. 'url': 'https://www.oneplace.com/ministries/a-daily-walk/listen/living-in-the-last-days-part-2-958461.html',
  6. 'info_dict': {
  7. 'id': '958461',
  8. 'ext': 'mp3',
  9. 'title': 'Living in the Last Days Part 2 | A Daily Walk with John Randall',
  10. 'description': 'md5:fbb8f1cf21447ac54ecaa2887fc20c6e',
  11. },
  12. }, {
  13. 'url': 'https://www.oneplace.com/ministries/ankerberg-show/listen/ep-3-relying-on-the-constant-companionship-of-the-holy-spirit-part-2-922513.html',
  14. 'info_dict': {
  15. 'id': '922513',
  16. 'ext': 'mp3',
  17. 'description': 'md5:8b810b4349aa40a5d033b4536fe428e1',
  18. 'title': 'md5:ce10f7d8d5ddcf485ed8905ef109659d',
  19. },
  20. }]
  21. def _real_extract(self, url):
  22. video_id = self._match_id(url)
  23. webpage = self._download_webpage(url, video_id)
  24. return {
  25. 'id': video_id,
  26. 'url': self._search_regex((
  27. r'mp3-url\s*=\s*"([^"]+)',
  28. r'<div[^>]+id\s*=\s*"player"[^>]+data-media-url\s*=\s*"(?P<media_url>[^"]+)',
  29. ), webpage, 'media url'),
  30. 'ext': 'mp3',
  31. 'vcodec': 'none',
  32. 'title': self._html_search_regex((
  33. r'<div[^>]class\s*=\s*"details"[^>]+>[^<]<h2[^>]+>(?P<content>[^>]+)>',
  34. self._meta_regex('og:title'), self._meta_regex('title'),
  35. ), webpage, 'title', group='content', default=None),
  36. 'description': self._html_search_regex(
  37. r'<div[^>]+class="[^"]+epDesc"[^>]*>\s*(?P<desc>.+?)\s*</div>',
  38. webpage, 'description', default=None),
  39. }