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.

49 lines
1.7 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from .nexx import NexxIE
  6. from ..utils import (
  7. int_or_none,
  8. str_or_none,
  9. )
  10. class FunkIE(InfoExtractor):
  11. _VALID_URL = r'https?://(?:www\.)?funk\.net/(?:channel|playlist)/[^/]+/(?P<display_id>[0-9a-z-]+)-(?P<id>\d+)'
  12. _TESTS = [{
  13. 'url': 'https://www.funk.net/channel/ba-793/die-lustigsten-instrumente-aus-dem-internet-teil-2-1155821',
  14. 'md5': '8dd9d9ab59b4aa4173b3197f2ea48e81',
  15. 'info_dict': {
  16. 'id': '1155821',
  17. 'ext': 'mp4',
  18. 'title': 'Die LUSTIGSTEN INSTRUMENTE aus dem Internet - Teil 2',
  19. 'description': 'md5:a691d0413ef4835588c5b03ded670c1f',
  20. 'timestamp': 1514507395,
  21. 'upload_date': '20171229',
  22. },
  23. }, {
  24. 'url': 'https://www.funk.net/playlist/neuesteVideos/kameras-auf-dem-fusion-festival-1618699',
  25. 'only_matching': True,
  26. }]
  27. def _real_extract(self, url):
  28. display_id, nexx_id = re.match(self._VALID_URL, url).groups()
  29. video = self._download_json(
  30. 'https://www.funk.net/api/v4.0/videos/' + nexx_id, nexx_id)
  31. return {
  32. '_type': 'url_transparent',
  33. 'url': 'nexx:741:' + nexx_id,
  34. 'ie_key': NexxIE.ie_key(),
  35. 'id': nexx_id,
  36. 'title': video.get('title'),
  37. 'description': video.get('description'),
  38. 'duration': int_or_none(video.get('duration')),
  39. 'channel_id': str_or_none(video.get('channelId')),
  40. 'display_id': display_id,
  41. 'tags': video.get('tags'),
  42. 'thumbnail': video.get('imageUrlLandscape'),
  43. }