mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2025-02-16 17:07:54 +01:00
[niconico] Fix extractor: re-encoded swf support
This commit is contained in:
parent
8c5879715f
commit
928433277f
@ -48,6 +48,7 @@ class NiconicoIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
'skip': 'Requires an account',
|
'skip': 'Requires an account',
|
||||||
}, {
|
}, {
|
||||||
|
# video was uploaded as .swf, and hasn't re-encoded (on web, FLASH player)
|
||||||
# File downloaded with and without credentials are different, so omit
|
# File downloaded with and without credentials are different, so omit
|
||||||
# the md5 field
|
# the md5 field
|
||||||
'url': 'http://www.nicovideo.jp/watch/nm14296458',
|
'url': 'http://www.nicovideo.jp/watch/nm14296458',
|
||||||
@ -284,9 +285,8 @@ class NiconicoIE(InfoExtractor):
|
|||||||
def _format_id_from_url(video_url):
|
def _format_id_from_url(video_url):
|
||||||
return 'economy' if video_real_url.endswith('low') else 'normal'
|
return 'economy' if video_real_url.endswith('low') else 'normal'
|
||||||
|
|
||||||
try:
|
# If the video is (originally) .swf, use the .swf version
|
||||||
video_real_url = api_data['video']['smileInfo']['url']
|
if video_id.startswith('nm'):
|
||||||
except KeyError: # Flash videos
|
|
||||||
# Get flv info
|
# Get flv info
|
||||||
flv_info_webpage = self._download_webpage(
|
flv_info_webpage = self._download_webpage(
|
||||||
'http://flapi.nicovideo.jp/api/getflv/' + video_id + '?as3=1',
|
'http://flapi.nicovideo.jp/api/getflv/' + video_id + '?as3=1',
|
||||||
@ -324,12 +324,17 @@ class NiconicoIE(InfoExtractor):
|
|||||||
if not extension:
|
if not extension:
|
||||||
extension = determine_ext(video_real_url)
|
extension = determine_ext(video_real_url)
|
||||||
|
|
||||||
formats = [{
|
if extension == 'swf':
|
||||||
'url': video_real_url,
|
formats = [{
|
||||||
'ext': extension,
|
'url': video_real_url,
|
||||||
'format_id': _format_id_from_url(video_real_url),
|
'ext': extension,
|
||||||
}]
|
'format_id': _format_id_from_url(video_real_url),
|
||||||
else:
|
}]
|
||||||
|
|
||||||
|
try:
|
||||||
|
formats
|
||||||
|
except NameError: # No swf video found
|
||||||
|
video_real_url = api_data['video']['smileInfo']['url']
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
dmc_info = api_data['video'].get('dmcInfo')
|
dmc_info = api_data['video'].get('dmcInfo')
|
||||||
|
Loading…
Reference in New Issue
Block a user