mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2026-01-05 08:09:07 +03:00
Remove connect fix now that it's been pushed upstream
This commit is contained in:
@@ -137,48 +137,3 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
|
||||
|
||||
async def set_auto_play_mode(self, enabled: bool):
|
||||
await super()._command("setAutoplayMode", {"autoplayMode": "ENABLED" if enabled else "DISABLED"})
|
||||
|
||||
# Here just temporarily, will be removed once the PR is merged on YTlounge
|
||||
async def connect(self) -> bool:
|
||||
"""Attempt to connect using the previously set tokens"""
|
||||
if not self.linked():
|
||||
raise NotLinkedException("Not linked")
|
||||
|
||||
connect_body = {
|
||||
"app": "web",
|
||||
"mdx-version": "3",
|
||||
"name": self.device_name,
|
||||
"id": self.auth.screen_id,
|
||||
"device": "REMOTE_CONTROL",
|
||||
"capabilities": "que,dsdtr,atp",
|
||||
"method": "setPlaylist",
|
||||
"magnaKey": "cloudPairedDevice",
|
||||
"ui": "false",
|
||||
"deviceContext": "user_agent=dunno&window_width_points=&window_height_points=&os_name=android&ms=",
|
||||
"theme": "cl",
|
||||
"loungeIdToken": self.auth.lounge_id_token,
|
||||
}
|
||||
connect_url = (
|
||||
f"{api_base}/bc/bind?RID=1&VER=8&CVER=1&auth_failure_option=send_error"
|
||||
)
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.post(url=connect_url, data=connect_body) as resp:
|
||||
try:
|
||||
text = await resp.text()
|
||||
if resp.status == 401:
|
||||
self.auth.lounge_id_token = None
|
||||
return False
|
||||
|
||||
if resp.status != 200:
|
||||
self._logger.warning(
|
||||
"Unknown reply to connect %i %s", resp.status, resp.reason
|
||||
)
|
||||
return False
|
||||
lines = text.splitlines()
|
||||
async for events in self._parse_event_chunks(desync(lines)):
|
||||
self._process_events(events)
|
||||
self._command_offset = 1
|
||||
return self.connected()
|
||||
except Exception as ex:
|
||||
self._logger.exception(ex, resp.status, resp.reason)
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user