[ie/twitter:spaces] Support video spaces (#10789)
[yt-dlp3.git] / yt_dlp / extractor / commonprotocols.py
blob7b3a5b654666703f49e63518e3c4df8f6ae49891
1 import urllib.parse
3 from .common import InfoExtractor
6 class RtmpIE(InfoExtractor):
7 IE_DESC = False # Do not list
8 _VALID_URL = r'(?i)rtmp[est]?://.+'
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,
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 }],
32 class MmsIE(InfoExtractor):
33 IE_DESC = False # Do not list
34 _VALID_URL = r'(?i)mms://.+'
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)',
44 'params': {
45 'skip_download': True, # rtsp downloads, requiring mplayer or mpv
49 def _real_extract(self, url):
50 video_id = self._generic_id(url)
51 title = self._generic_title(url)
53 return {
54 'id': video_id,
55 'title': title,
56 'url': url,
60 class ViewSourceIE(InfoExtractor):
61 IE_DESC = False
62 _VALID_URL = r'view-source:(?P<url>.+)'
64 _TEST = {
65 'url': 'view-source:https://www.youtube.com/watch?v=BaW_jenozKc',
66 'only_matching': True,
69 def _real_extract(self, url):
70 return self.url_result(self._match_valid_url(url).group('url'))