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.

47 lines
1.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class OktoberfestTVIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?oktoberfest-tv\.de/[^/]+/[^/]+/video/(?P<id>[^/?#]+)'
  6. _TEST = {
  7. 'url': 'http://www.oktoberfest-tv.de/de/kameras/video/hb-zelt',
  8. 'info_dict': {
  9. 'id': 'hb-zelt',
  10. 'ext': 'mp4',
  11. 'title': 're:^Live-Kamera: Hofbräuzelt [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
  12. 'thumbnail': r're:^https?://.*\.jpg$',
  13. 'is_live': True,
  14. },
  15. 'params': {
  16. 'skip_download': True,
  17. }
  18. }
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(url, video_id)
  22. title = self._live_title(self._html_search_regex(
  23. r'<h1><strong>.*?</strong>(.*?)</h1>', webpage, 'title'))
  24. clip = self._search_regex(
  25. r"clip:\s*\{\s*url:\s*'([^']+)'", webpage, 'clip')
  26. ncurl = self._search_regex(
  27. r"netConnectionUrl:\s*'([^']+)'", webpage, 'rtmp base')
  28. video_url = ncurl + clip
  29. thumbnail = self._search_regex(
  30. r"canvas:\s*\{\s*backgroundImage:\s*'url\(([^)]+)\)'", webpage,
  31. 'thumbnail', fatal=False)
  32. return {
  33. 'id': video_id,
  34. 'title': title,
  35. 'url': video_url,
  36. 'ext': 'mp4',
  37. 'is_live': True,
  38. 'thumbnail': thumbnail,
  39. }