From 2d12783b9c7dd7564062ac737ef09de5fff1c7fb Mon Sep 17 00:00:00 2001 From: JChris246 Date: Sun, 16 Mar 2025 01:45:05 -0400 Subject: [PATCH 1/6] fix: differentiate between direct urls and m3u8 --- yt_dlp/extractor/fc2.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index f7b883155c..671a2cee51 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -22,8 +22,23 @@ class FC2IE(InfoExtractor): 'md5': 'a6ebe8ebe0396518689d963774a54eb7', 'info_dict': { 'id': '20121103kUan1KHs', - 'ext': 'flv', 'title': 'Boxing again with Puff', + 'ext': 'mp4', + 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?' + }, + 'file_minsize': 633, + 'params': { + 'skip_download': True + }, + }, { + 'url': 'https://video.fc2.com/content/20121129xMeT3Czt', + 'md5': '19109bbee429d5b3765986505d44a012', + 'info_dict': { + 'id': '20121129xMeT3Czt', + 'title': 'Rotfux', + 'ext': 'mp4', + 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?', + 'description': 'Rotfux', }, }, { 'url': 'http://video.fc2.com/en/content/20150125cEva0hDn/', @@ -99,12 +114,18 @@ def _real_extract(self, url): raise ExtractorError('Unable to extract video URL') vid_url = urljoin('https://video.fc2.com/', vid_url) + if vidplaylist.get('type') == '1': + formats = self._extract_m3u8_formats(vid_url, video_id, 'mp4',) + else: + formats = [{ + 'url': vid_url, + 'ext': 'mp4', + }] + return { 'id': video_id, 'title': title, - 'url': vid_url, - 'ext': 'mp4', - 'protocol': 'm3u8_native', + 'formats': formats, 'description': description, 'thumbnail': thumbnail, } From 481328cc19b35b601a66d27df1e00a07c26158d8 Mon Sep 17 00:00:00 2001 From: JChris246 Date: Sun, 16 Mar 2025 03:04:00 -0400 Subject: [PATCH 2/6] fix: correct lint errors --- yt_dlp/extractor/fc2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index 671a2cee51..f97483c4e4 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -24,11 +24,11 @@ class FC2IE(InfoExtractor): 'id': '20121103kUan1KHs', 'title': 'Boxing again with Puff', 'ext': 'mp4', - 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?' + 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?', }, 'file_minsize': 633, 'params': { - 'skip_download': True + 'skip_download': True, }, }, { 'url': 'https://video.fc2.com/content/20121129xMeT3Czt', @@ -115,7 +115,7 @@ def _real_extract(self, url): vid_url = urljoin('https://video.fc2.com/', vid_url) if vidplaylist.get('type') == '1': - formats = self._extract_m3u8_formats(vid_url, video_id, 'mp4',) + formats = self._extract_m3u8_formats(vid_url, video_id, 'mp4') else: formats = [{ 'url': vid_url, From 409754d22952b808c87d380df3329394d4d30fdb Mon Sep 17 00:00:00 2001 From: JChris246 Date: Sun, 16 Mar 2025 18:03:31 -0400 Subject: [PATCH 3/6] fix: address PR comments --- yt_dlp/extractor/fc2.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index f97483c4e4..b892c2357e 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -24,20 +24,22 @@ class FC2IE(InfoExtractor): 'id': '20121103kUan1KHs', 'title': 'Boxing again with Puff', 'ext': 'mp4', - 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?', + 'thumbnail': 're:https?://.+\.jpe?g', }, 'file_minsize': 633, 'params': { - 'skip_download': True, + # Video too small to pass test + 'skip_download': 'm3u8', }, }, { + # Direct video url 'url': 'https://video.fc2.com/content/20121129xMeT3Czt', 'md5': '19109bbee429d5b3765986505d44a012', 'info_dict': { 'id': '20121129xMeT3Czt', 'title': 'Rotfux', 'ext': 'mp4', - 'thumbnail': 're:^https?://.+.jpg?(?:\\d+)?', + 'thumbnail': 're:https?://.+\.jpe?g', 'description': 'Rotfux', }, }, { From e92b6f53b92e9699740b23bbe77085836fca2274 Mon Sep 17 00:00:00 2001 From: JChris246 Date: Sun, 16 Mar 2025 18:52:30 -0400 Subject: [PATCH 4/6] fix: escape sequence --- yt_dlp/extractor/fc2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index b892c2357e..4765626901 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -24,7 +24,7 @@ class FC2IE(InfoExtractor): 'id': '20121103kUan1KHs', 'title': 'Boxing again with Puff', 'ext': 'mp4', - 'thumbnail': 're:https?://.+\.jpe?g', + 'thumbnail': 're:https?://.+\\.jpe?g', }, 'file_minsize': 633, 'params': { @@ -39,7 +39,7 @@ class FC2IE(InfoExtractor): 'id': '20121129xMeT3Czt', 'title': 'Rotfux', 'ext': 'mp4', - 'thumbnail': 're:https?://.+\.jpe?g', + 'thumbnail': 're:https?://.+\\.jpe?g', 'description': 'Rotfux', }, }, { From 0b759aea4bfc95ebcf45c31bb7afb14c763ec947 Mon Sep 17 00:00:00 2001 From: JChris246 Date: Sun, 16 Mar 2025 19:16:36 -0400 Subject: [PATCH 5/6] fix: update with fixes from PR comments --- yt_dlp/extractor/fc2.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index 4765626901..70b19498ff 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -24,11 +24,10 @@ class FC2IE(InfoExtractor): 'id': '20121103kUan1KHs', 'title': 'Boxing again with Puff', 'ext': 'mp4', - 'thumbnail': 're:https?://.+\\.jpe?g', + 'thumbnail': r're:https?://.+\.jpe?g', }, 'file_minsize': 633, 'params': { - # Video too small to pass test 'skip_download': 'm3u8', }, }, { @@ -39,7 +38,7 @@ class FC2IE(InfoExtractor): 'id': '20121129xMeT3Czt', 'title': 'Rotfux', 'ext': 'mp4', - 'thumbnail': 're:https?://.+\\.jpe?g', + 'thumbnail': r're:https?://.+\.jpe?g', 'description': 'Rotfux', }, }, { From c2e75eade907768575307af471b1daced539e6bd Mon Sep 17 00:00:00 2001 From: JChris246 <43832407+JChris246@users.noreply.github.com> Date: Sun, 16 Mar 2025 19:41:48 -0400 Subject: [PATCH 6/6] remove file_minsize Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com> --- yt_dlp/extractor/fc2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index 70b19498ff..863b46060e 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -26,7 +26,6 @@ class FC2IE(InfoExtractor): 'ext': 'mp4', 'thumbnail': r're:https?://.+\.jpe?g', }, - 'file_minsize': 633, 'params': { 'skip_download': 'm3u8', },