oktoberfesttv.py 1.4 KB

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