[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 .myvi import (
)
from .myvideoge import MyVideoGeIE
from .myvidster import MyVidsterIE
from .n1 import N1InfoIIE, N1InfoAssetIE
from .n1 import (
N1InfoAssetIE,
N1InfoIIE,
)
from .nationalgeographic import (
NationalGeographicVideoIE,
NationalGeographicTVIE,

View File

@ -3,8 +3,6 @@ from __future__ import unicode_literals
import re
from .youtube import YoutubeIE
from .reddit import RedditRIE
from .common import InfoExtractor
from ..utils import (
unified_timestamp,
@ -40,7 +38,7 @@ class N1InfoAssetIE(InfoExtractor):
class N1InfoIIE(InfoExtractor):
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 = [{
# 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 @@ class N1InfoIIE(InfoExtractor):
'title': title,
'thumbnail': video_data.get('data-thumbnail'),
'timestamp': timestamp,
'ie_key': N1InfoAssetIE.ie_key()})
'ie_key': 'N1InfoAsset'})
embedded_videos = re.findall(r'(<iframe[^>]+>)', 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',