vimm.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. from .common import InfoExtractor
  2. class VimmIE(InfoExtractor):
  3. IE_NAME = 'Vimm:stream'
  4. _VALID_URL = r'https?://(?:www\.)?vimm\.tv/(?:c/)?(?P<id>[0-9a-z-]+)$'
  5. _TESTS = [{
  6. 'url': 'https://www.vimm.tv/c/calimeatwagon',
  7. 'info_dict': {
  8. 'id': 'calimeatwagon',
  9. 'ext': 'mp4',
  10. 'title': 're:^calimeatwagon [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
  11. 'live_status': 'is_live',
  12. },
  13. 'skip': 'Live',
  14. }, {
  15. 'url': 'https://www.vimm.tv/octaafradio',
  16. 'only_matching': True,
  17. }]
  18. def _real_extract(self, url):
  19. channel_id = self._match_id(url)
  20. formats, subs = self._extract_m3u8_formats_and_subtitles(
  21. f'https://www.vimm.tv/hls/{channel_id}.m3u8', channel_id, 'mp4', m3u8_id='hls', live=True)
  22. return {
  23. 'id': channel_id,
  24. 'title': channel_id,
  25. 'is_live': True,
  26. 'formats': formats,
  27. 'subtitles': subs,
  28. }
  29. class VimmRecordingIE(InfoExtractor):
  30. IE_NAME = 'Vimm:recording'
  31. _VALID_URL = r'https?://(?:www\.)?vimm\.tv/c/(?P<channel_id>[0-9a-z-]+)\?v=(?P<video_id>[0-9A-Za-z]+)'
  32. _TESTS = [{
  33. 'url': 'https://www.vimm.tv/c/kaldewei?v=2JZsrPTFxsSz',
  34. 'md5': '15122ee95baa32a548e4a3e120b598f1',
  35. 'info_dict': {
  36. 'id': '2JZsrPTFxsSz',
  37. 'ext': 'mp4',
  38. 'title': 'VIMM - [DE/GER] Kaldewei Live - In Farbe und Bunt',
  39. 'uploader_id': 'kaldewei',
  40. },
  41. }]
  42. def _real_extract(self, url):
  43. channel_id, video_id = self._match_valid_url(url).groups()
  44. webpage = self._download_webpage(url, video_id)
  45. title = self._og_search_title(webpage)
  46. formats, subs = self._extract_m3u8_formats_and_subtitles(
  47. f'https://d211qfrkztakg3.cloudfront.net/{channel_id}/{video_id}/index.m3u8', video_id, 'mp4', m3u8_id='hls', live=False)
  48. return {
  49. 'id': video_id,
  50. 'title': title,
  51. 'is_live': False,
  52. 'uploader_id': channel_id,
  53. 'formats': formats,
  54. 'subtitles': subs,
  55. }