From cfc297d8f56c9f36be82f2dca8553e711bebfaca Mon Sep 17 00:00:00 2001 From: playma Date: Fri, 27 Sep 2019 08:28:19 +0800 Subject: [PATCH] [fc2] Fix video download --- youtube_dl/extractor/fc2.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/youtube_dl/extractor/fc2.py b/youtube_dl/extractor/fc2.py index 435561147..9538439e1 100644 --- a/youtube_dl/extractor/fc2.py +++ b/youtube_dl/extractor/fc2.py @@ -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, }