Browse Source

[naver] Add rtmp formats (fixes #3054)

totalwebcasting
Jaime Marquínez Ferrándiz 11 years ago
parent
commit
087ca2cb07
2 changed files with 12 additions and 4 deletions
  1. +3
    -0
      youtube_dl/downloader/rtmp.py
  2. +9
    -4
      youtube_dl/extractor/naver.py

+ 3
- 0
youtube_dl/downloader/rtmp.py View File

@ -96,6 +96,7 @@ class RtmpFD(FileDownloader):
flash_version = info_dict.get('flash_version', None) flash_version = info_dict.get('flash_version', None)
live = info_dict.get('rtmp_live', False) live = info_dict.get('rtmp_live', False)
conn = info_dict.get('rtmp_conn', None) conn = info_dict.get('rtmp_conn', None)
protocol = info_dict.get('rtmp_protocol', None)
self.report_destination(filename) self.report_destination(filename)
tmpfilename = self.temp_name(filename) tmpfilename = self.temp_name(filename)
@ -133,6 +134,8 @@ class RtmpFD(FileDownloader):
basic_args += ['--conn', entry] basic_args += ['--conn', entry]
elif isinstance(conn, compat_str): elif isinstance(conn, compat_str):
basic_args += ['--conn', conn] basic_args += ['--conn', conn]
if protocol is not None:
basic_args += ['--protocol', protocol]
args = basic_args + [[], ['--resume', '--skip', '1']][not live and self.params.get('continuedl', False)] args = basic_args + [[], ['--resume', '--skip', '1']][not live and self.params.get('continuedl', False)]
if sys.platform == 'win32' and sys.version_info < (3, 0): if sys.platform == 'win32' and sys.version_info < (3, 0):


+ 9
- 4
youtube_dl/extractor/naver.py View File

@ -47,14 +47,19 @@ class NaverIE(InfoExtractor):
formats = [] formats = []
for format_el in urls.findall('EncodingOptions/EncodingOption'): for format_el in urls.findall('EncodingOptions/EncodingOption'):
domain = format_el.find('Domain').text domain = format_el.find('Domain').text
if domain.startswith('rtmp'):
continue
formats.append({
f = {
'url': domain + format_el.find('uri').text, 'url': domain + format_el.find('uri').text,
'ext': 'mp4', 'ext': 'mp4',
'width': int(format_el.find('width').text), 'width': int(format_el.find('width').text),
'height': int(format_el.find('height').text), 'height': int(format_el.find('height').text),
})
}
if domain.startswith('rtmp'):
f.update({
'ext': 'flv',
'rtmp_protocol': '1', # rtmpt
})
formats.append(f)
self._sort_formats(formats)
return { return {
'id': video_id, 'id': video_id,


Loading…
Cancel
Save