- appKey_var = self._search_regex(r'value\("appGridApplicationKey",([0-9a-f]+)\)', gigya_sc, 'appKey variable')
- appKey = self._search_regex(r'var %s="([0-9a-f]+)"' % appKey_var, gigya_sc, 'appKey')
- uid = compat_str(uuid.uuid4())
- session_url = 'https://appgrid-api.cloud.accedo.tv/session?appKey=%s&uuid=%s' % (appKey, uid)
- session_json = self._download_json(session_url, video_id, 'Downloading session keys')
- sessionKey = compat_str(session_json['sessionKey'])
-
- paths_url = 'https://appgrid-api.cloud.accedo.tv/metadata/general_configuration,%20web_configuration?sessionKey=' + sessionKey
- paths = self._download_json(paths_url, video_id, 'Downloading paths JSON')
+ appKey = self._search_regex(
+ r'constant\s*\(\s*["\']_appGridApplicationKey["\']\s*,\s*["\']([0-9a-f]+)',
+ gigya_sc, 'appKey')
+
+ session_json = self._download_json(
+ 'https://appgrid-api.cloud.accedo.tv/session',
+ video_id, 'Downloading session keys', query={
+ 'appKey': appKey,
+ 'uuid': compat_str(uuid.uuid4()),
+ })
+
+ paths = self._download_json(
+ 'https://appgrid-api.cloud.accedo.tv/metadata/general_configuration,%20web_configuration',
+ video_id, 'Downloading paths JSON',
+ query={'sessionKey': compat_str(session_json['sessionKey'])})
+