]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/funk.py
Prepare to release
[youtubedl] / youtube_dl / extractor / funk.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from .nexx import NexxIE
6 from ..utils import extract_attributes
7
8
9 class FunkIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?funk\.net/(?:mix|channel)/(?:[^/]+/)*(?P<id>[^?/#]+)'
11 _TESTS = [{
12 'url': 'https://www.funk.net/mix/59d65d935f8b160001828b5b/0/59d517e741dca10001252574/',
13 'md5': '4d40974481fa3475f8bccfd20c5361f8',
14 'info_dict': {
15 'id': '716599',
16 'ext': 'mp4',
17 'title': 'Neue Rechte Welle',
18 'description': 'md5:a30a53f740ffb6bfd535314c2cc5fb69',
19 'timestamp': 1501337639,
20 'upload_date': '20170729',
21 },
22 'params': {
23 'format': 'bestvideo',
24 'skip_download': True,
25 },
26 }, {
27 'url': 'https://www.funk.net/channel/59d5149841dca100012511e3/0/59d52049999264000182e79d/',
28 'only_matching': True,
29 }]
30
31 def _real_extract(self, url):
32 video_id = self._match_id(url)
33
34 webpage = self._download_webpage(url, video_id)
35
36 domain_id = NexxIE._extract_domain_id(webpage) or '741'
37 nexx_id = extract_attributes(self._search_regex(
38 r'(<div[^>]id=["\']mediaplayer-funk[^>]+>)',
39 webpage, 'media player'))['data-id']
40
41 return self.url_result(
42 'nexx:%s:%s' % (domain_id, nexx_id), ie=NexxIE.ie_key(),
43 video_id=nexx_id)