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.

56 lines
2.0 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class ServusIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?servus\.com/(?:(?:at|de)/p/[^/]+|tv/videos)/(?P<id>[aA]{2}-\w+|\d+-\d+)'
  7. _TESTS = [{
  8. 'url': 'https://www.servus.com/de/p/Die-Gr%C3%BCnen-aus-Sicht-des-Volkes/AA-1T6VBU5PW1W12/',
  9. 'md5': '3e1dd16775aa8d5cbef23628cfffc1f4',
  10. 'info_dict': {
  11. 'id': 'AA-1T6VBU5PW1W12',
  12. 'ext': 'mp4',
  13. 'title': 'Die Grünen aus Sicht des Volkes',
  14. 'description': 'md5:1247204d85783afe3682644398ff2ec4',
  15. 'thumbnail': r're:^https?://.*\.jpg',
  16. }
  17. }, {
  18. 'url': 'https://www.servus.com/at/p/Wie-das-Leben-beginnt/1309984137314-381415152/',
  19. 'only_matching': True,
  20. }, {
  21. 'url': 'https://www.servus.com/tv/videos/aa-1t6vbu5pw1w12/',
  22. 'only_matching': True,
  23. }, {
  24. 'url': 'https://www.servus.com/tv/videos/1380889096408-1235196658/',
  25. 'only_matching': True,
  26. }]
  27. def _real_extract(self, url):
  28. video_id = self._match_id(url).upper()
  29. webpage = self._download_webpage(url, video_id)
  30. title = self._search_regex(
  31. (r'videoLabel\s*=\s*(["\'])(?P<title>(?:(?!\1).)+)\1',
  32. r'<h\d+[^>]+\bclass=["\']heading--(?:one|two)["\'][^>]*>(?P<title>[^<]+)'),
  33. webpage, 'title', default=None,
  34. group='title') or self._og_search_title(webpage)
  35. title = re.sub(r'\s*-\s*Servus TV\s*$', '', title)
  36. description = self._og_search_description(webpage)
  37. thumbnail = self._og_search_thumbnail(webpage)
  38. formats = self._extract_m3u8_formats(
  39. 'https://stv.rbmbtnx.net/api/v1/manifests/%s.m3u8' % video_id,
  40. video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls')
  41. self._sort_formats(formats)
  42. return {
  43. 'id': video_id,
  44. 'title': title,
  45. 'description': description,
  46. 'thumbnail': thumbnail,
  47. 'formats': formats,
  48. }