From 17df9031ef8e81033994b7334c14bced4d9aa999 Mon Sep 17 00:00:00 2001 From: fayer3 Date: Wed, 23 Sep 2020 17:02:11 +0200 Subject: [PATCH] v0.4.13: - change VOD request to the one received from the server, this limits playback in most cases to SD resolution without Plus+. --- addon.xml | 4 +++- changelog.txt | 4 +++- resources/lib/plugin.py | 36 +++++++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/addon.xml b/addon.xml index 69f8b54..ab9709e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -72,6 +72,8 @@ - verfügbar seit/bis zu Filmbeschreibungen hinzugefügt. 0.4.12: - VOD Abfrage repariert dank hrickes. +0.4.13: +- ändernder VOD Abfrage zu der vom Server erhaltenen, dies limitiert tie Auflösung auf SD ohne Plus+. resources/icon.png diff --git a/changelog.txt b/changelog.txt index c241be0..c948a60 100644 --- a/changelog.txt +++ b/changelog.txt @@ -76,4 +76,6 @@ v0.4.11: - fix error that prevented retrieving of videos. - added available since/until to movie description. v0.4.12: -- fixed VOD request thanks to hrickes. \ No newline at end of file +- fixed VOD request thanks to hrickes. +v0.4.13: +- change VOD request to the one received from the server, this limits playback in most cases to SD resolution without Plus+. \ No newline at end of file diff --git a/resources/lib/plugin.py b/resources/lib/plugin.py index 92985dc..562bbe8 100644 --- a/resources/lib/plugin.py +++ b/resources/lib/plugin.py @@ -55,8 +55,9 @@ try: from urllib.request import Request, urlopen, build_opener, ProxyHandler from urllib.error import HTTPError, URLError - from urllib.parse import quote, unquote + from urllib.parse import quote, unquote, urlparse, parse_qs except ImportError: + from urlparse import urlparse, parse_qs from urllib import quote, unquote from urllib2 import Request, urlopen, HTTPError, URLError, build_opener, ProxyHandler @@ -985,17 +986,30 @@ def play_video(video_id, tvshow_id, brand, duration): #got add, extract mpd log(u'stream with add: {0}'.format(video_data['videoUrl'])) video_url = video_data['videoUrl'] - video_url_data = get_url(video_url, headers={'User-Agent': ids.video_useragent}, key = False, critical = True) - # get base url - base_urls = re.findall('(.*?)',video_url_data) - if len(base_urls) > 0 and base_urls[0].startswith('http'): - video_url = base_urls[0] + u'.mpd?filter=(type%3D%3D%22video%22)%7C%7C(true)|User-Agent='+ids.video_useragent - else: - kodiutils.notification(u'INFO', kodiutils.get_string(32005)) - setResolvedUrl(plugin.handle, False, playitem) - return + + found = False + #parse url an look if viedo url with filter is included + parsed_url = urlparse(video_url) + if parsed_url[4]: + parsed_query = parse_qs(parsed_url[4]) + if 'yo.p.fn' in parsed_query and len(parsed_query['yo.p.fn']) > 0: + found = True + #add missing padding + base64_url_with_padding = parsed_query['yo.p.fn'][0] + '===' + log(u'base64 url: {0}'.format(base64_url_with_padding)) + video_url = base64.b64decode(base64_url_with_padding) + if not found: + video_url_data = get_url(video_url, headers={'User-Agent': ids.video_useragent}, key = False, critical = True) + # get base url + base_urls = re.findall('(.*?)',video_url_data) + if len(base_urls) > 0 and base_urls[0].startswith('http'): + video_url = base_urls[0] + u'.mpd?filter=(type%3D%3D%22video%22)%7C%7C(true)|User-Agent='+ids.video_useragent + else: + kodiutils.notification(u'INFO', kodiutils.get_string(32005)) + setResolvedUrl(plugin.handle, False, playitem) + return else: - video_url = video_data['videoUrl'].rpartition('?')[0] + u'|User-Agent='+ids.video_useragent + video_url = video_data['videoUrl']+ u'|User-Agent='+ids.video_useragent#.rpartition('?')[0] + u'|User-Agent='+ids.video_useragent is_helper = None if video_data['drm'] != u'widevine':