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