1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-02-14 22:19:54 +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
thumbnail = None
if webpage is not None:
title = self._og_search_title(webpage)
thumbnail = self._og_search_thumbnail(webpage)
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()
@ -100,24 +100,25 @@ class FC2IE(InfoExtractor):
info_url, video_id, note='Downloading info page')
info = compat_urlparse.parse_qs(info_webpage)
if 'err_code' in info:
# most of the time we can still download wideo even if err_code is 403 or 602
self.report_warning(
'Error code was: %s... but still trying' % info['err_code'][0])
if 'filepath' not in info:
raise ExtractorError('Cannot download file. Are you logged in?')
video_url = info['filepath'][0] + '?mid=' + info['mid'][0]
video_info_url = 'https://video.fc2.com/api/v3/videoplaylist/{}?sh=1&fs=0'.format(video_id)
info_webpage = self._download_webpage(
info_url, video_id, note='Downloading info page')
info = compat_urlparse.parse_qs(info_webpage)
title_info = info.get('title')
if title_info:
title = title_info[0]
response = self._download_json(
video_info_url,
video_id,
)
video_url = 'https://video.fc2.com' + response['playlist']['nq']
return {
'id': video_id,
'title': title,
'url': video_url,
'ext': 'flv',
'ext': 'mp4',
'thumbnail': thumbnail,
}