From 31fe6a8d722cdd79a3d307a66c5f624bbf067b43 Mon Sep 17 00:00:00 2001 From: Paco8 <5084042+Paco8@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:06:12 +0200 Subject: [PATCH] Version 0.5.9 --- addon.xml | 2 +- resources/lib/ads.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/addon.xml b/addon.xml index 38ad3b0..d7c1a96 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/ads.py b/resources/lib/ads.py index 7ae7732..3de7675 100644 --- a/resources/lib/ads.py +++ b/resources/lib/ads.py @@ -7,7 +7,13 @@ import json import requests -from urllib.parse import urlparse, urlunparse, parse_qs, urlencode +try: + # Python 3 + from urllib.parse import urlparse, urlunparse, parse_qs, urlencode +except ImportError: + # Python 2 + from urlparse import urlparse, urlunparse, parse_qs + from urllib import urlencode def get_fw_data(profile_id, playback_info, account, territory, headers, platform): freewheel = playback_info['response']['thirdParties']['FREEWHEEL'] @@ -91,6 +97,9 @@ def get_ad_url(video_url, fw_data, headers, platform): url = parsed_url.scheme + '://mt.ssai.peacocktv.com' + parsed_url.path #print(url) + ads_params = fw_data['globalParameters'].copy() + ads_params.update(fw_data['keyValues']) + post_data = { "reportingMode":"client", "availSuppression":{ @@ -100,7 +109,7 @@ def get_ad_url(video_url, fw_data, headers, platform): "playerParams":{ "origin_domain": original_host }, - "adsParams": {**fw_data['globalParameters'], **fw_data['keyValues']} + "adsParams": ads_params } #print(json.dumps(post_data, indent=4)) #print(json.dumps(query_params, indent=4))