[ie/rtvslo.si:show] Add extractor (#8418)

Authored by: JSubelj, seproDev

Co-authored-by: sepro <4618135+seproDev@users.noreply.github.com>
This commit is contained in:
JSubelj 2024-06-14 00:51:12 +02:00 committed by GitHub
parent 3690c2f598
commit 92a1c4abae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 96 additions and 69 deletions

View file

@ -1755,7 +1755,10 @@
RTVETelevisionIE, RTVETelevisionIE,
) )
from .rtvs import RTVSIE from .rtvs import RTVSIE
from .rtvslo import RTVSLOIE from .rtvslo import (
RTVSLOIE,
RTVSLOShowIE,
)
from .rudovideo import RudoVideoIE from .rudovideo import RudoVideoIE
from .rule34video import Rule34VideoIE from .rule34video import Rule34VideoIE
from .rumble import ( from .rumble import (

View file

@ -1,3 +1,5 @@
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
@ -6,6 +8,7 @@
traverse_obj, traverse_obj,
unified_timestamp, unified_timestamp,
url_or_none, url_or_none,
urljoin,
) )
@ -21,8 +24,7 @@ class RTVSLOIE(InfoExtractor):
_API_BASE = 'https://api.rtvslo.si/ava/{}/{}?client_id=82013fb3a531d5414f478747c1aca622' _API_BASE = 'https://api.rtvslo.si/ava/{}/{}?client_id=82013fb3a531d5414f478747c1aca622'
SUB_LANGS_MAP = {'Slovenski': 'sl'} SUB_LANGS_MAP = {'Slovenski': 'sl'}
_TESTS = [ _TESTS = [{
{
'url': 'https://www.rtvslo.si/rtv365/arhiv/174842550?s=tv', 'url': 'https://www.rtvslo.si/rtv365/arhiv/174842550?s=tv',
'info_dict': { 'info_dict': {
'id': '174842550', 'id': '174842550',
@ -88,8 +90,7 @@ class RTVSLOIE(InfoExtractor):
}, { }, {
'url': 'https://4d.rtvslo.si/arhiv/dnevnik/174842550', 'url': 'https://4d.rtvslo.si/arhiv/dnevnik/174842550',
'only_matching': True, 'only_matching': True,
}, }]
]
def _real_extract(self, url): def _real_extract(self, url):
v_id = self._match_id(url) v_id = self._match_id(url)
@ -164,3 +165,26 @@ def _real_extract(self, url):
'series': meta.get('showName'), 'series': meta.get('showName'),
'series_id': meta.get('showId'), 'series_id': meta.get('showId'),
} }
class RTVSLOShowIE(InfoExtractor):
IE_NAME = 'rtvslo.si:show'
_VALID_URL = r'https?://(?:365|4d)\.rtvslo.si/oddaja/[^/?#&]+/(?P<id>\d+)'
_TESTS = [{
'url': 'https://365.rtvslo.si/oddaja/ekipa-bled/173250997',
'info_dict': {
'id': '173250997',
'title': 'Ekipa Bled',
},
'playlist_count': 18,
}]
def _real_extract(self, url):
playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id)
return self.playlist_from_matches(
re.findall(r'<a [^>]*\bhref="(/arhiv/[^"]+)"', webpage),
playlist_id, self._html_extract_title(webpage),
getter=lambda x: urljoin('https://365.rtvslo.si', x), ie=RTVSLOIE)