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