Skip to content

Commit

Permalink
Merge pull request #735 from MoojMidge/v7.0.6
Browse files Browse the repository at this point in the history
v7.0.6.2
  • Loading branch information
MoojMidge authored Apr 30, 2024
2 parents 0c817c0 + c8a7667 commit cf4dd4c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion 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="plugin.video.youtube" name="YouTube" version="7.0.6.1" provider-name="anxdpanic, bromix, MoojMidge">
<addon id="plugin.video.youtube" name="YouTube" version="7.0.6.2" provider-name="anxdpanic, bromix, MoojMidge">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="2.27.1"/>
Expand Down
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
43 changes: 21 additions & 22 deletions resources/lib/youtube_plugin/youtube/client/request_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -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
Expand All @@ -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',
Expand All @@ -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
Expand Down Expand Up @@ -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': {
Expand All @@ -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]}',
Expand All @@ -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)
Expand All @@ -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': {
Expand All @@ -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
Expand All @@ -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': {
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit cf4dd4c

Please sign in to comment.