]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/funk.py
[LnkIE] Add extractor (#2408)
[yt-dlp.git] / yt_dlp / extractor / funk.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4
5 from .common import InfoExtractor
6 from .nexx import NexxIE
7 from ..utils import (
8 int_or_none,
9 str_or_none,
10 )
11
12
13 class FunkIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.|origin\.)?funk\.net/(?:channel|playlist)/[^/]+/(?P<display_id>[0-9a-z-]+)-(?P<id>\d+)'
15 _TESTS = [{
16 'url': 'https://www.funk.net/channel/ba-793/die-lustigsten-instrumente-aus-dem-internet-teil-2-1155821',
17 'md5': '8dd9d9ab59b4aa4173b3197f2ea48e81',
18 'info_dict': {
19 'id': '1155821',
20 'ext': 'mp4',
21 'title': 'Die LUSTIGSTEN INSTRUMENTE aus dem Internet - Teil 2',
22 'description': 'md5:a691d0413ef4835588c5b03ded670c1f',
23 'timestamp': 1514507395,
24 'upload_date': '20171229',
25 },
26
27 }, {
28 'url': 'https://www.funk.net/playlist/neuesteVideos/kameras-auf-dem-fusion-festival-1618699',
29 'only_matching': True,
30 }]
31
32 def _real_extract(self, url):
33 display_id, nexx_id = self._match_valid_url(url).groups()
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 }