From 0f6518938d9b9084aa182368908893603389b89d Mon Sep 17 00:00:00 2001 From: u-spec-png <54671367+u-spec-png@users.noreply.github.com> Date: Thu, 4 Nov 2021 15:29:59 +0000 Subject: [PATCH] [N1] Add support for nova.rs (#1537) Authored by: u-spec-png --- yt_dlp/extractor/extractors.py | 5 ++++- yt_dlp/extractor/n1.py | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 5fc18f7a06..88f17ca93d 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -836,7 +836,10 @@ ) from .myvideoge import MyVideoGeIE from .myvidster import MyVidsterIE -from .n1 import N1InfoIIE, N1InfoAssetIE +from .n1 import ( + N1InfoAssetIE, + N1InfoIIE, +) from .nationalgeographic import ( NationalGeographicVideoIE, NationalGeographicTVIE, diff --git a/yt_dlp/extractor/n1.py b/yt_dlp/extractor/n1.py index 7a09c6779c..75d63c8930 100644 --- a/yt_dlp/extractor/n1.py +++ b/yt_dlp/extractor/n1.py @@ -3,8 +3,6 @@ import re -from .youtube import YoutubeIE -from .reddit import RedditRIE from .common import InfoExtractor from ..utils import ( unified_timestamp, @@ -40,7 +38,7 @@ def _real_extract(self, url): class N1InfoIIE(InfoExtractor): IE_NAME = 'N1Info:article' - _VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P[^/]+)' + _VALID_URL = r'https?://(?:(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)|nova\.rs)/(?:[^/]+/){1,2}(?P[^/]+)' _TESTS = [{ # Youtube embedded 'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/', @@ -93,6 +91,15 @@ class N1InfoIIE(InfoExtractor): 'format': 'bestvideo', 'skip_download': True, }, + }, { + 'url': 'https://nova.rs/vesti/politika/zaklina-tatalovic-ani-brnabic-pricate-lazi-video/', + 'info_dict': { + 'id': 'tnjganabrnabicizaklinatatalovic100danavladegp-novas-worldwide', + 'ext': 'mp4', + 'title': 'Žaklina Tatalović Ani Brnabić: Pričate laži (VIDEO)', + 'upload_date': '20211102', + 'timestamp': 1635861677, + }, }, { 'url': 'https://hr.n1info.com/vijesti/pravobraniteljica-o-ubojstvu-u-zagrebu-radi-se-o-doista-nezapamcenoj-situaciji/', 'only_matching': True, @@ -116,16 +123,16 @@ def _real_extract(self, url): 'title': title, 'thumbnail': video_data.get('data-thumbnail'), 'timestamp': timestamp, - 'ie_key': N1InfoAssetIE.ie_key()}) + 'ie_key': 'N1InfoAsset'}) embedded_videos = re.findall(r'(]+>)', webpage) for embedded_video in embedded_videos: video_data = extract_attributes(embedded_video) - url = video_data.get('src') + url = video_data.get('src') or '' if url.startswith('https://www.youtube.com'): - entries.append(self.url_result(url, ie=YoutubeIE.ie_key())) + entries.append(self.url_result(url, ie='Youtube')) elif url.startswith('https://www.redditmedia.com'): - entries.append(self.url_result(url, ie=RedditRIE.ie_key())) + entries.append(self.url_result(url, ie='RedditR')) return { '_type': 'playlist',