diff --git a/TikTokApi/tiktok.py b/TikTokApi/tiktok.py index 77f6cf15..f5a7770a 100644 --- a/TikTokApi/tiktok.py +++ b/TikTokApi/tiktok.py @@ -548,7 +548,7 @@ def userPage( ) = self.__process_kwargs__(kwargs) kwargs["custom_did"] = did - api_url = "https://m.tiktok.com/api/item_list/?{}&count={}&id={}&type=1&secUid={}" "&minCursor={}&maxCursor={}&sourceType=8&appId=1233®ion={}&language={}".format( + api_url = BASE_URL + "api/item_list/?{}&count={}&id={}&type=1&secUid={}" "&minCursor={}&maxCursor={}&sourceType=8&appId=1233®ion={}&language={}".format( self.__add_new_params__(), page_size, str(userID), @@ -1102,11 +1102,11 @@ def getUser(self, username, **kwargs) -> dict: did, ) = self.__process_kwargs__(kwargs) r = requests.get( - "https://tiktok.com/@{}?lang=en".format(username), + "https://tiktok.com/@{}?lang=en".format(quote(username)), headers={ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "authority": "www.tiktok.com", - "path": "/{}".format(username), + "path": "/@{}".format(quote(username)), "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Host": "www.tiktok.com", @@ -1484,11 +1484,11 @@ def get_music_title(self, id, **kwargs): def get_secUid(self, username, **kwargs): r = requests.get( - "https://tiktok.com/@{}?lang=en".format(username), + "https://tiktok.com/@{}?lang=en".format(quote(username)), headers={ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "authority": "www.tiktok.com", - "path": "/{}".format(username), + "path": "/@{}".format(quote(username)), "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Host": "www.tiktok.com", diff --git a/setup.py b/setup.py index cd127137..6ea12fd9 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name="TikTokApi", packages=["TikTokApi"], - version="3.8.6", + version="3.8.7", license="MIT", description="The Unofficial TikTok API Wrapper in Python 3.", author="David Teather",