Skip to content

Commit

Permalink
Fix improperly handled parameterization & remove X-Bogus from default…
Browse files Browse the repository at this point in the history
… params to fix gift list
  • Loading branch information
isaackogan committed Sep 19, 2024
1 parent 66560f3 commit 4a4fd24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions TikTokLive/client/web/web_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ async def get_response(
self.params["uuc"] = self.__uuc
self.params["device_id"] = self.generate_device_id()

params = '&'.join(f"{key}={value}" for key, value in {**(self.params if base_params else {}), **(extra_params or dict())}.items())

# Make the request
return await (client or self._httpx).get(
url=url,
url=url + "?" + params,
cookies=self.cookies,
params={**(self.params if base_params else {}), **(extra_params or dict())},
headers={**(self.headers if base_headers else {}), **(extra_headers or dict())},
**kwargs
)
Expand Down
4 changes: 2 additions & 2 deletions TikTokLive/client/web/web_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def user_agent_to_device_preset(user_agent: str) -> DevicePreset:
# Safe='' is used to make it so that the slashes in the user agent string are escaped
return {
"user_agent": user_agent,
"browser_name": urllib.parse.quote_plus(browser_name),
"browser_version": urllib.parse.quote_plus(browser_version),
"browser_name": urllib.parse.quote(browser_name, safe=''),
"browser_version": urllib.parse.quote(browser_version, safe=''),
"browser_platform": "MacIntel" if "Macintosh" in user_agent else "Win32",
"os": "mac" if "Macintosh" in user_agent else "windows"
}
Expand Down
4 changes: 1 addition & 3 deletions TikTokLive/client/web/web_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@
"user_is_login": "false",
"webcast_language": Location["lang"],

# Empty Signature Codes
# Note: Never include X-Bogus
"msToken": "",
"X-Bogus": "",
"_signature": "",

}

Expand Down

0 comments on commit 4a4fd24

Please sign in to comment.