fix(JOYNAT): fix GraphQL variables encoding
This commit is contained in:
@@ -416,7 +416,7 @@ class JOYNAT(Service):
|
|||||||
self, *, challenge: bytes, title: Union[Movies, Series], track: AnyTrack,
|
self, *, challenge: bytes, title: Union[Movies, Series], track: AnyTrack,
|
||||||
) -> Optional[Union[bytes, str]]:
|
) -> Optional[Union[bytes, str]]:
|
||||||
"""Obtain a Widevine license for the given track."""
|
"""Obtain a Widevine license for the given track."""
|
||||||
license_url = getattr(track, 'data', {}).get('license_url') if track.data else None
|
license_url = track.data.get('license_url')
|
||||||
if not license_url:
|
if not license_url:
|
||||||
raise ValueError("No license_url in track.data.")
|
raise ValueError("No license_url in track.data.")
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ class JOYNAT(Service):
|
|||||||
},
|
},
|
||||||
params={
|
params={
|
||||||
'operationName': operation_name,
|
'operationName': operation_name,
|
||||||
'variables': json.dumps(variables).encode(),
|
'variables': json.dumps(variables),
|
||||||
'extensions': json.dumps({
|
'extensions': json.dumps({
|
||||||
'persistedQuery': {'version': 1, 'sha256Hash': persisted_query_hash}
|
'persistedQuery': {'version': 1, 'sha256Hash': persisted_query_hash}
|
||||||
}).encode()
|
}).encode()
|
||||||
@@ -451,6 +451,9 @@ class JOYNAT(Service):
|
|||||||
|
|
||||||
response_data = response.json()
|
response_data = response.json()
|
||||||
|
|
||||||
|
if response_data.get("errors"):
|
||||||
|
raise ValueError(f"GraphQL errors for '{operation_name}': {response_data['errors']}")
|
||||||
|
|
||||||
if 'data' not in response_data:
|
if 'data' not in response_data:
|
||||||
self.log.error(f"GraphQL response for '{operation_name}' missing 'data' field.")
|
self.log.error(f"GraphQL response for '{operation_name}' missing 'data' field.")
|
||||||
raise ValueError(f"Invalid GraphQL response for '{operation_name}'.")
|
raise ValueError(f"Invalid GraphQL response for '{operation_name}'.")
|
||||||
|
|||||||
@@ -437,8 +437,13 @@ class RTLP(Service):
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
response_data = response.json()
|
response_data = response.json()
|
||||||
|
|
||||||
|
if response_data.get("errors"):
|
||||||
|
raise ValueError(f"GraphQL errors for '{operation_name}': {response_data['errors']}")
|
||||||
|
|
||||||
if 'data' not in response_data:
|
if 'data' not in response_data:
|
||||||
raise ValueError(f"Invalid GraphQL response for '{operation_name}': missing 'data' field.")
|
self.log.error(f"GraphQL response for '{operation_name}' missing 'data' field.")
|
||||||
|
raise ValueError(f"Invalid GraphQL response for '{operation_name}'.")
|
||||||
|
|
||||||
return response_data['data']
|
return response_data['data']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user