diff --git a/addon.xml b/addon.xml index a1e4e39e4..49d83f0b0 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index ecd198cad..d8e3d5cd6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,4 @@ -## v7.0.6.1 +## v7.0.6.2 ### Fixed - Improve updating containers and (re)loading windows #681 - Fix refreshing video listing also forcing next pages to refresh when loaded @@ -20,6 +20,7 @@ - Enable MPEG-DASH for live streams by default #680 - Setup Wizard will prompt to run when plugin first opens after updating, in order to update default settings - http server will shutdown on idle timeout #699 +- Update client details used for player requests ### New - Add recommended settings in Setup Wizard for Raspberry Pi 1/2 class devices #688 diff --git a/resources/lib/youtube_plugin/youtube/client/request_client.py b/resources/lib/youtube_plugin/youtube/client/request_client.py index 88071629d..0c00debdb 100644 --- a/resources/lib/youtube_plugin/youtube/client/request_client.py +++ b/resources/lib/youtube_plugin/youtube/client/request_client.py @@ -19,6 +19,12 @@ class YouTubeRequestClient(BaseRequestsClass): # yt-dlp has chosen the following value, but this results in the android # player response returning unexpected details sometimes. To be investigated # _ANDROID_PARAMS = 'CgIIAQ==' + _API_KEYS = { + 'android': 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w', + 'android_embedded': 'AIzaSyCjc_pVEDi4qsv5MtC2dMXzpIaDoRFLsxw', + 'ios': 'AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc', + 'web': 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', + } CLIENTS = { # 4k no VP9 HDR @@ -49,18 +55,17 @@ class YouTubeRequestClient(BaseRequestsClass): 'X-YouTube-Client-Version': '{json[context][client][clientVersion]}', }, 'params': { - 'key': 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w', + 'key': _API_KEYS['android'], }, }, 'android': { '_id': 3, '_query_subtitles': 'optional', 'json': { - 'params': _ANDROID_PARAMS, 'context': { 'client': { 'clientName': 'ANDROID', - 'clientVersion': '19.12.36', + 'clientVersion': '19.17.34', 'androidSdkVersion': '34', 'osName': 'Android', 'osVersion': '14', @@ -77,9 +82,6 @@ class YouTubeRequestClient(BaseRequestsClass): 'X-YouTube-Client-Name': '{_id}', 'X-YouTube-Client-Version': '{json[context][client][clientVersion]}', }, - 'params': { - 'key': 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w', - }, }, # Only for videos that allow embedding # Limited to 720p on some videos @@ -91,7 +93,7 @@ class YouTubeRequestClient(BaseRequestsClass): 'context': { 'client': { 'clientName': 'ANDROID_EMBEDDED_PLAYER', - 'clientVersion': '19.12.36', + 'clientVersion': '19.17.34', 'clientScreen': 'EMBED', 'androidSdkVersion': '34', 'osName': 'Android', @@ -112,9 +114,6 @@ class YouTubeRequestClient(BaseRequestsClass): 'X-YouTube-Client-Name': '{_id}', 'X-YouTube-Client-Version': '{json[context][client][clientVersion]}', }, - 'params': { - 'key': 'AIzaSyCjc_pVEDi4qsv5MtC2dMXzpIaDoRFLsxw', - }, }, # 4k with HDR # Some videos block this client, may also require embedding enabled @@ -145,7 +144,7 @@ class YouTubeRequestClient(BaseRequestsClass): 'X-YouTube-Client-Version': '{json[context][client][clientVersion]}', }, 'params': { - 'key': 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w', + 'key': _API_KEYS['android'], }, }, 'ios': { @@ -160,7 +159,7 @@ class YouTubeRequestClient(BaseRequestsClass): 'context': { 'client': { 'clientName': 'IOS', - 'clientVersion': '19.12.3', + 'clientVersion': '19.16.3', 'deviceModel': 'iPhone16,2', 'osName': 'iOS', 'osVersion': '{_os[major]}.{_os[minor]}.{_os[patch]}.{_os[build]}', @@ -178,9 +177,6 @@ class YouTubeRequestClient(BaseRequestsClass): 'X-YouTube-Client-Name': '{_id}', 'X-YouTube-Client-Version': '{json[context][client][clientVersion]}', }, - 'params': { - 'key': 'AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc', - }, }, # Used to requests captions for clients that don't provide them # Requires handling of nsig to overcome throttling (TODO) @@ -205,7 +201,7 @@ class YouTubeRequestClient(BaseRequestsClass): ' 85.0.4183.93/6.5 TV Safari/537.36'), }, 'params': { - 'key': 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', + 'key': _API_KEYS['web'], }, }, 'media_connect_frontend': { @@ -221,7 +217,7 @@ class YouTubeRequestClient(BaseRequestsClass): }, 'headers': {}, 'params': { - 'key': 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', + 'key': _API_KEYS['web'], }, }, # Used for misc api requests by default @@ -245,7 +241,7 @@ class YouTubeRequestClient(BaseRequestsClass): 'Referer': 'https://www.youtube.com/watch?v={json[videoId]}' }, 'params': { - 'key': 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', + 'key': _API_KEYS['web'], }, }, '_common': { @@ -357,10 +353,13 @@ def build_client(cls, client_name, data=None): client = merge_dicts(cls.CLIENTS['_common'], client, templates) client['_name'] = client_name - if client.get('_access_token'): - del client['params']['key'] - elif 'Authorization' in client['headers']: - del client['headers']['Authorization'] + try: + if client.get('_access_token'): + del client['params']['key'] + elif 'Authorization' in client['headers']: + del client['headers']['Authorization'] + except KeyError: + pass for values, template_id, template in templates.values(): if template_id in values: