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.

43 lines
1.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from .nexx import NexxIE
  5. from ..utils import extract_attributes
  6. class FunkIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.)?funk\.net/(?:mix|channel)/(?:[^/]+/)*(?P<id>[^?/#]+)'
  8. _TESTS = [{
  9. 'url': 'https://www.funk.net/mix/59d65d935f8b160001828b5b/0/59d517e741dca10001252574/',
  10. 'md5': '4d40974481fa3475f8bccfd20c5361f8',
  11. 'info_dict': {
  12. 'id': '716599',
  13. 'ext': 'mp4',
  14. 'title': 'Neue Rechte Welle',
  15. 'description': 'md5:a30a53f740ffb6bfd535314c2cc5fb69',
  16. 'timestamp': 1501337639,
  17. 'upload_date': '20170729',
  18. },
  19. 'params': {
  20. 'format': 'bestvideo',
  21. 'skip_download': True,
  22. },
  23. }, {
  24. 'url': 'https://www.funk.net/channel/59d5149841dca100012511e3/0/59d52049999264000182e79d/',
  25. 'only_matching': True,
  26. }]
  27. def _real_extract(self, url):
  28. video_id = self._match_id(url)
  29. webpage = self._download_webpage(url, video_id)
  30. domain_id = NexxIE._extract_domain_id(webpage) or '741'
  31. nexx_id = extract_attributes(self._search_regex(
  32. r'(<div[^>]id=["\']mediaplayer-funk[^>]+>)',
  33. webpage, 'media player'))['data-id']
  34. return self.url_result(
  35. 'nexx:%s:%s' % (domain_id, nexx_id), ie=NexxIE.ie_key(),
  36. video_id=nexx_id)