[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / commonprotocols.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..compat import (
5     compat_urlparse,
6 )
7
8
9 class RtmpIE(InfoExtractor):
10     IE_DESC = False  # Do not list
11     _VALID_URL = r'(?i)rtmp[est]?://.+'
12
13     _TESTS = [{
14         'url': 'rtmp://cp44293.edgefcs.net/ondemand?auth=daEcTdydfdqcsb8cZcDbAaCbhamacbbawaS-bw7dBb-bWG-GqpGFqCpNCnGoyL&aifp=v001&slist=public/unsecure/audio/2c97899446428e4301471a8cb72b4b97--audio--pmg-20110908-0900a_flv_aac_med_int.mp4',
15         'only_matching': True,
16     }, {
17         'url': 'rtmp://edge.live.hitbox.tv/live/dimak',
18         'only_matching': True,
19     }]
20
21     def _real_extract(self, url):
22         video_id = self._generic_id(url)
23         title = self._generic_title(url)
24         return {
25             'id': video_id,
26             'title': title,
27             'formats': [{
28                 'url': url,
29                 'ext': 'flv',
30                 'format_id': compat_urlparse.urlparse(url).scheme,
31             }],
32         }
33
34
35 class MmsIE(InfoExtractor):
36     IE_DESC = False  # Do not list
37     _VALID_URL = r'(?i)mms://.+'
38
39     _TEST = {
40         # Direct MMS link
41         'url': 'mms://kentro.kaist.ac.kr/200907/MilesReid(0709).wmv',
42         'info_dict': {
43             'id': 'MilesReid(0709)',
44             'ext': 'wmv',
45             'title': 'MilesReid(0709)',
46         },
47         'params': {
48             'skip_download': True,  # rtsp downloads, requiring mplayer or mpv
49         },
50     }
51
52     def _real_extract(self, url):
53         video_id = self._generic_id(url)
54         title = self._generic_title(url)
55
56         return {
57             'id': video_id,
58             'title': title,
59             'url': url,
60         }