mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-22 07:43:08 +00:00
[generic,commonprotocols] Move mms suuport from GenericIE
And use _generic_* helpers in those extractors
This commit is contained in:
parent
98763ee354
commit
9dcd6fd3aa
3 changed files with 33 additions and 29 deletions
|
@ -1,7 +1,7 @@
|
||||||
version <unreleased>
|
version <unreleased>
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
+ [generic] Support direct MMS links (#10838)
|
+ [commonprotocols] Support direct MMS links (#10838)
|
||||||
|
|
||||||
|
|
||||||
version 2016.10.02
|
version 2016.10.02
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_urllib_parse_unquote,
|
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
)
|
)
|
||||||
from ..utils import url_basename
|
|
||||||
|
|
||||||
|
|
||||||
class RtmpIE(InfoExtractor):
|
class RtmpIE(InfoExtractor):
|
||||||
|
@ -23,8 +19,8 @@ class RtmpIE(InfoExtractor):
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = compat_urllib_parse_unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])
|
video_id = self._generic_id(url)
|
||||||
title = compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0])
|
title = self._generic_title(url)
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
|
@ -34,3 +30,31 @@ class RtmpIE(InfoExtractor):
|
||||||
'format_id': compat_urlparse.urlparse(url).scheme,
|
'format_id': compat_urlparse.urlparse(url).scheme,
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MmsIE(InfoExtractor):
|
||||||
|
IE_DESC = False # Do not list
|
||||||
|
_VALID_URL = r'(?i)mms://.+'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
# Direct MMS link
|
||||||
|
'url': 'mms://kentro.kaist.ac.kr/200907/MilesReid(0709).wmv',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'MilesReid(0709)',
|
||||||
|
'ext': 'wmv',
|
||||||
|
'title': 'MilesReid(0709)',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True, # rtsp downloads, requiring mplayer or mpv
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._generic_id(url)
|
||||||
|
title = self._generic_title(url)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'url': url,
|
||||||
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ from ..utils import (
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
UnsupportedError,
|
UnsupportedError,
|
||||||
url_basename,
|
|
||||||
xpath_text,
|
xpath_text,
|
||||||
)
|
)
|
||||||
from .brightcove import (
|
from .brightcove import (
|
||||||
|
@ -1412,18 +1411,6 @@ class GenericIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
'playlist_mincount': 3,
|
'playlist_mincount': 3,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
# Direct MMS link
|
|
||||||
'url': 'mms://kentro.kaist.ac.kr/200907/MilesReid(0709).wmv',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'MilesReid(0709)',
|
|
||||||
'ext': 'wmv',
|
|
||||||
'title': 'MilesReid(0709)',
|
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'skip_download': True, # rtsp downloads, requiring mplayer or mpv
|
|
||||||
},
|
|
||||||
},
|
|
||||||
# {
|
# {
|
||||||
# # TODO: find another test
|
# # TODO: find another test
|
||||||
# # http://schema.org/VideoObject
|
# # http://schema.org/VideoObject
|
||||||
|
@ -1561,14 +1548,7 @@ class GenericIE(InfoExtractor):
|
||||||
force_videoid = smuggled_data['force_videoid']
|
force_videoid = smuggled_data['force_videoid']
|
||||||
video_id = force_videoid
|
video_id = force_videoid
|
||||||
else:
|
else:
|
||||||
video_id = compat_urllib_parse_unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])
|
video_id = self._generic_id(url)
|
||||||
|
|
||||||
if parsed_url.scheme == 'mms':
|
|
||||||
return {
|
|
||||||
'id': video_id,
|
|
||||||
'title': video_id,
|
|
||||||
'url': url,
|
|
||||||
}
|
|
||||||
|
|
||||||
self.to_screen('%s: Requesting header' % video_id)
|
self.to_screen('%s: Requesting header' % video_id)
|
||||||
|
|
||||||
|
@ -1597,7 +1577,7 @@ class GenericIE(InfoExtractor):
|
||||||
|
|
||||||
info_dict = {
|
info_dict = {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0]),
|
'title': self._generic_title(url),
|
||||||
'upload_date': unified_strdate(head_response.headers.get('Last-Modified'))
|
'upload_date': unified_strdate(head_response.headers.get('Last-Modified'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue