[N1] Add support for nova.rs (#1537)

Authored by: u-spec-png
This commit is contained in:
u-spec-png 2021-11-04 15:29:59 +00:00 committed by GitHub
parent 22cd06c452
commit 0f6518938d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View file

@ -836,7 +836,10 @@
) )
from .myvideoge import MyVideoGeIE from .myvideoge import MyVideoGeIE
from .myvidster import MyVidsterIE from .myvidster import MyVidsterIE
from .n1 import N1InfoIIE, N1InfoAssetIE from .n1 import (
N1InfoAssetIE,
N1InfoIIE,
)
from .nationalgeographic import ( from .nationalgeographic import (
NationalGeographicVideoIE, NationalGeographicVideoIE,
NationalGeographicTVIE, NationalGeographicTVIE,

View file

@ -3,8 +3,6 @@
import re import re
from .youtube import YoutubeIE
from .reddit import RedditRIE
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
unified_timestamp, unified_timestamp,
@ -40,7 +38,7 @@ def _real_extract(self, url):
class N1InfoIIE(InfoExtractor): class N1InfoIIE(InfoExtractor):
IE_NAME = 'N1Info:article' IE_NAME = 'N1Info:article'
_VALID_URL = r'https?://(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)/(?:[^/]+/){1,2}(?P<id>[^/]+)' _VALID_URL = r'https?://(?:(?:(?:ba|rs|hr)\.)?n1info\.(?:com|si)|nova\.rs)/(?:[^/]+/){1,2}(?P<id>[^/]+)'
_TESTS = [{ _TESTS = [{
# Youtube embedded # Youtube embedded
'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/', 'url': 'https://rs.n1info.com/sport-klub/tenis/kako-je-djokovic-propustio-istorijsku-priliku-video/',
@ -93,6 +91,15 @@ class N1InfoIIE(InfoExtractor):
'format': 'bestvideo', 'format': 'bestvideo',
'skip_download': True, '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/', 'url': 'https://hr.n1info.com/vijesti/pravobraniteljica-o-ubojstvu-u-zagrebu-radi-se-o-doista-nezapamcenoj-situaciji/',
'only_matching': True, 'only_matching': True,
@ -116,16 +123,16 @@ def _real_extract(self, url):
'title': title, 'title': title,
'thumbnail': video_data.get('data-thumbnail'), 'thumbnail': video_data.get('data-thumbnail'),
'timestamp': timestamp, 'timestamp': timestamp,
'ie_key': N1InfoAssetIE.ie_key()}) 'ie_key': 'N1InfoAsset'})
embedded_videos = re.findall(r'(<iframe[^>]+>)', webpage) embedded_videos = re.findall(r'(<iframe[^>]+>)', webpage)
for embedded_video in embedded_videos: for embedded_video in embedded_videos:
video_data = extract_attributes(embedded_video) video_data = extract_attributes(embedded_video)
url = video_data.get('src') url = video_data.get('src') or ''
if url.startswith('https://www.youtube.com'): 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'): 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 { return {
'_type': 'playlist', '_type': 'playlist',