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