]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/commonprotocols.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / commonprotocols.py
1 import urllib.parse
2
3 from .common import InfoExtractor
4
5
6 class RtmpIE(InfoExtractor):
7 IE_DESC = False # Do not list
8 _VALID_URL = r'(?i)rtmp[est]?://.+'
9
10 _TESTS = [{
11 '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',
12 'only_matching': True,
13 }, {
14 'url': 'rtmp://edge.live.hitbox.tv/live/dimak',
15 'only_matching': True,
16 }]
17
18 def _real_extract(self, url):
19 video_id = self._generic_id(url)
20 title = self._generic_title(url)
21 return {
22 'id': video_id,
23 'title': title,
24 'formats': [{
25 'url': url,
26 'ext': 'flv',
27 'format_id': urllib.parse.urlparse(url).scheme,
28 }],
29 }
30
31
32 class MmsIE(InfoExtractor):
33 IE_DESC = False # Do not list
34 _VALID_URL = r'(?i)mms://.+'
35
36 _TEST = {
37 # Direct MMS link
38 'url': 'mms://kentro.kaist.ac.kr/200907/MilesReid(0709).wmv',
39 'info_dict': {
40 'id': 'MilesReid(0709)',
41 'ext': 'wmv',
42 'title': 'MilesReid(0709)',
43 },
44 'params': {
45 'skip_download': True, # rtsp downloads, requiring mplayer or mpv
46 },
47 }
48
49 def _real_extract(self, url):
50 video_id = self._generic_id(url)
51 title = self._generic_title(url)
52
53 return {
54 'id': video_id,
55 'title': title,
56 'url': url,
57 }
58
59
60 class ViewSourceIE(InfoExtractor):
61 IE_DESC = False
62 _VALID_URL = r'view-source:(?P<url>.+)'
63
64 _TEST = {
65 'url': 'view-source:https://www.youtube.com/watch?v=BaW_jenozKc',
66 'only_matching': True,
67 }
68
69 def _real_extract(self, url):
70 return self.url_result(self._match_valid_url(url).group('url'))