Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script.module.libard/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.libard" name="libard" version="6.0.2" provider-name="sarbes">
<addon id="script.module.libard" name="libard" version="6.0.3" provider-name="sarbes">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.libmediathek4" version="1.0.0"/>
Expand Down
48 changes: 40 additions & 8 deletions script.module.libard/lib/libardnewjsonparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,47 @@ def parseSearchVOD(self,client='ard',text=''):
"""

def parseVideo(self,clipId='Y3JpZDovL2JyLmRlL3ZpZGVvL2NkNzBjODMwLTM2ZTAtNDljNC1iMDJiLTQyNWNhMWIyZDg3NA',client="ard"):
j = requests.get(f'{apiUrl}/mediacollection/{clipId}?devicetype={self.deviceType}',headers=headers).json()
for item in j['_mediaArray'][0]['_mediaStreamArray']:
if item['_quality'] == 'auto':
url = item['_stream']
if url.startswith('//'):
url = 'http:' + url
response = requests.get(
f'{apiUrl}/pages/ard/item/{clipId}?embedded=false&mcV6=true&devicetype={self.deviceType}',
headers=headers
)
response.raise_for_status()
j = response.json()

mediaCollection = next(
widget['mediaCollection']['embedded']
for widget in j['widgets']
if 'mediaCollection' in widget
)

url = None
for stream in mediaCollection.get('streams', []):
for media in stream.get('media', []):
if media.get('mimeType') == 'application/vnd.apple.mpegurl':
url = media['url']
break
if url:
break

if not url:
raise RuntimeError('ARD: no HLS stream found')

d = {'media':[{'url':url, 'stream':'HLS'}]}
if '_subtitleUrl' in j:
d['subtitle'] = [{'url':j['_subtitleUrl'], 'type':'ttml', 'lang':'de', 'colour':True}]

subtitles = []
for subtitle in mediaCollection.get('subtitles', []):
for source in subtitle.get('sources', []):
if source.get('kind') == 'webvtt':
subtitles.append({
'url': source['url'],
'type': 'webvtt',
'lang': subtitle.get('languageCode', 'deu'),
'colour': True
})

if subtitles:
d['subtitle'] = subtitles

return d


Expand Down
Loading