Skip to content

Commit

Permalink
Disable android player request client by default #737
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed May 3, 2024
1 parent c8a7667 commit ebf0cb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 11 additions & 3 deletions resources/lib/youtube_plugin/youtube/client/request_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class YouTubeRequestClient(BaseRequestsClass):
},
'android': {
'_id': 3,
'_disabled': True,
'_query_subtitles': 'optional',
'json': {
'context': {
Expand Down Expand Up @@ -343,11 +344,18 @@ def json_traverse(cls, json_data, path, default=None):
return result

@classmethod
def build_client(cls, client_name, data=None):
def build_client(cls, client_name=None, data=None):
templates = {}

client = (cls.CLIENTS.get(client_name)
or YouTubeRequestClient.CLIENTS['web']).copy()
client = None
if client_name:
client = cls.CLIENTS.get(client_name)
if client and client.get('_disabled'):
return None
if not client:
client = YouTubeRequestClient.CLIENTS['web']
client = client.copy()

if data:
client = merge_dicts(client, data)
client = merge_dicts(cls.CLIENTS['_common'], client, templates)
Expand Down
4 changes: 4 additions & 0 deletions resources/lib/youtube_plugin/youtube/helper/video_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ def _get_video_info(self):
)
)
client = self.build_client(client_name, client_data)
if not client:
continue

result = self.request(
video_info_url,
Expand Down Expand Up @@ -1420,6 +1422,8 @@ def _get_video_info(self):
and subtitles.sub_selection == subtitles.LANG_ALL)):
for client_name in ('smarttv_embedded', 'web', 'android'):
caption_client = self.build_client(client_name, client_data)
if not caption_client:
continue
result = self.request(
video_info_url,
'POST',
Expand Down

0 comments on commit ebf0cb4

Please sign in to comment.