1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-02-15 06:29:53 +00:00

[fc2] Fix video download

This commit is contained in:
playma 2019-09-27 08:28:19 +08:00
parent 8130ac42e5
commit cfc297d8f5

View File

@ -86,8 +86,8 @@ class FC2IE(InfoExtractor):
title = 'FC2 video %s' % video_id title = 'FC2 video %s' % video_id
thumbnail = None thumbnail = None
if webpage is not None: if webpage is not None:
title = self._og_search_title(webpage)
thumbnail = self._og_search_thumbnail(webpage) thumbnail = self._og_search_thumbnail(webpage)
refer = url.replace('/content/', '/a/content/') if '/a/content/' not in url else url refer = url.replace('/content/', '/a/content/') if '/a/content/' not in url else url
mimi = hashlib.md5((video_id + '_gGddgPfeaf_gzyr').encode('utf-8')).hexdigest() mimi = hashlib.md5((video_id + '_gGddgPfeaf_gzyr').encode('utf-8')).hexdigest()
@ -100,24 +100,25 @@ class FC2IE(InfoExtractor):
info_url, video_id, note='Downloading info page') info_url, video_id, note='Downloading info page')
info = compat_urlparse.parse_qs(info_webpage) info = compat_urlparse.parse_qs(info_webpage)
if 'err_code' in info: video_info_url = 'https://video.fc2.com/api/v3/videoplaylist/{}?sh=1&fs=0'.format(video_id)
# most of the time we can still download wideo even if err_code is 403 or 602 info_webpage = self._download_webpage(
self.report_warning( info_url, video_id, note='Downloading info page')
'Error code was: %s... but still trying' % info['err_code'][0]) info = compat_urlparse.parse_qs(info_webpage)
if 'filepath' not in info:
raise ExtractorError('Cannot download file. Are you logged in?')
video_url = info['filepath'][0] + '?mid=' + info['mid'][0]
title_info = info.get('title') title_info = info.get('title')
if title_info: if title_info:
title = title_info[0] title = title_info[0]
response = self._download_json(
video_info_url,
video_id,
)
video_url = 'https://video.fc2.com' + response['playlist']['nq']
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
'url': video_url, 'url': video_url,
'ext': 'flv', 'ext': 'mp4',
'thumbnail': thumbnail, 'thumbnail': thumbnail,
} }