From e9ce4e92501fbe8cc0761ec94f16346d8ba65434 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 7 Nov 2022 02:59:53 +0530 Subject: [PATCH] [extractor/foxnews] Add `FoxNewsVideo` extractor Closes #5133 --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/foxnews.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index 7612d291d..acec580d5 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -588,6 +588,7 @@ from .foxgay import FoxgayIE from .foxnews import ( FoxNewsIE, FoxNewsArticleIE, + FoxNewsVideoIE, ) from .foxsports import FoxSportsIE from .fptplay import FptplayIE diff --git a/yt_dlp/extractor/foxnews.py b/yt_dlp/extractor/foxnews.py index a0b116608..52172aace 100644 --- a/yt_dlp/extractor/foxnews.py +++ b/yt_dlp/extractor/foxnews.py @@ -75,6 +75,29 @@ class FoxNewsIE(AMPIE): return info +class FoxNewsVideoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?foxnews\.com/video/(?P\d+)' + _TESTS = [{ + 'url': 'https://www.foxnews.com/video/6313058664112', + 'info_dict': { + 'id': '6313058664112', + 'ext': 'mp4', + 'thumbnail': r're:https://.+/1280x720/match/image\.jpg', + 'upload_date': '20220930', + 'description': 'New York City, Kids Therapy, Biden', + 'duration': 2415, + 'title': 'Gutfeld! - Thursday, September 29', + 'timestamp': 1664527538, + }, + 'expected_warnings': ['Ignoring subtitle tracks'], + 'params': {'skip_download': 'm3u8'}, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + return self.url_result(f'https://video.foxnews.com/v/{video_id}', FoxNewsIE, video_id) + + class FoxNewsArticleIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:insider\.)?foxnews\.com/(?!v)([^/]+/)+(?P[a-z-]+)' IE_NAME = 'foxnews:article'