Hello,
I’m testing out tiktokpy because it supports authentication and has got the feature to follow people. However, I’m unable to follow people, I get this error (my @ is replaced with XXX):
2021-07-17 19:42:53 | INFO | 🥳 TikTokPy initialized. Version: 0.8.9
2021-07-17 19:42:54 | INFO | 🔧 Settings successfully loaded
2021-07-17 19:42:54 | INFO | ✅ Used cookies of @XXX
2021-07-17 19:42:54 | INFO | 🧭 Going to @l.a.zulkarnain's page for following
2021-07-17 19:42:54 | INFO | ✋ TikTokPy finished working. Session lasted: a moment
Traceback (most recent call last):
File "/home/maxime/Documents/coding/cerise/test/test.py", line 9, in <module>
asyncio.run(main())
File "/usr/lib64/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/maxime/Documents/coding/cerise/test/test.py", line 7, in main
await bot.follow("l.a.zulkarnain")
File "/home/maxime/Documents/coding/cerise/test/env/lib64/python3.9/site-packages/tiktokpy/bot/__init__.py", line 66, in follow
await User(client=self.client).follow(username=username)
File "/home/maxime/Documents/coding/cerise/test/env/lib64/python3.9/site-packages/tiktokpy/client/user.py", line 109, in follow
await self.client.goto(
File "/home/maxime/Documents/coding/cerise/test/env/lib64/python3.9/site-packages/tiktokpy/client/__init__.py", line 87, in goto
return await page.goto(full_url, *args, **kwargs)
File "/home/maxime/Documents/coding/cerise/test/env/lib64/python3.9/site-packages/pyppeteer/page.py", line 879, in goto
raise PageError(result)
pyppeteer.errors.PageError: net::ERR_INVALID_RESPONSE at https://www.tiktok.com/@l.a.zulkarnain
Here is the very basic python script:
import asyncio
from tiktokpy import TikTokPy
async def main():
async with TikTokPy() as bot:
await bot.follow("l.a.zulkarnain")
asyncio.run(main())
First, I had a lot of trouble to authenticate and by looking through the code, I saw I needed a "COOKIES" entry on the settings.toml file. Here’s what I put in it (in json.. and value fields are replaced with XXX):
[{"name": "tt_webid_v2", "value": "XXX", "domain": ".tiktok.com"}, {"name": "tt_webid", "value": "XXX", "domain": ".tiktok.com"}, {"name": "tt_csrf_token", "value": "XXX", "domain": ".tiktok.com"}, {"name": "R6kq3TV7", "value": "XXX", "domain": ".tiktok.com"}, {"name": "csrf_session_id", "value": "XXX", "domain": "www.tiktok.com"}, {"name": "s_v_web_id", "value": "XXX", "domain": "www.tiktok.com"}, {"name": "passport_csrf_token_default", "value": "XXX", "domain": ".tiktok.com"}, {"name": "passport_csrf_token", "value": "XXX", "domain": ".tiktok.com"}, {"name": "MONITOR_WEB_ID", "value": "XXX", "domain": ".www.tiktok.com"}, {"name": "sid_guard", "value": "XXX", "domain": ".tiktok.com"}, {"name": "uid_tt", "value": "XXX", "domain": ".tiktok.com"}, {"name": "uid_tt_ss", "value": "XXX", "domain": ".tiktok.com"}, {"name": "sid_tt", "value": "XXX", "domain": ".tiktok.com"}, {"name": "sessionid", "value": "XXX", "domain": ".tiktok.com"}, {"name": "sessionid_ss", "value": "XXX", "domain": ".tiktok.com"}, {"name": "store-idc", "value": "XXX", "domain": ".tiktok.com"}, {"name": "store-country-code", "value": "XXX", "domain": ".tiktok.com"}, {"name": "cmpl_token", "value": "XXX", "domain": ".tiktok.com"}, {"name": "passport_fe_beating_status", "value": "XXX", "domain": ".www.tiktok.com"}, {"name": "odin_tt", "value": "XXX", "domain": ".tiktok.com"}, {"name": "ttwid", "value": "XXX", "domain": ".tiktok.com"}, {"name": "tt_webid_v2", "value": "XXX", "domain": ".tiktok.com"}, {"name": "tt_webid", "value": "XXX", "domain": ".tiktok.com"}, {"name": "tt_csrf_token", "value": "XXX", "domain": ".tiktok.com"}, {"name": "R6kq3TV7", "value": "XXX", "domain": ".tiktok.com"}, {"name": "csrf_session_id", "value": "XXX", "domain": "www.tiktok.com"}, {"name": "s_v_web_id", "value": "XXX", "domain": "www.tiktok.com"}, {"name": "passport_csrf_token_default", "value": "XXX", "domain": ".tiktok.com"}, {"name": "passport_csrf_token", "value": "XXX", "domain": ".tiktok.com"}, {"name": "MONITOR_WEB_ID", "value": "XXX", "domain": ".www.tiktok.com"}, {"name": "sid_guard", "value": "XXX", "domain": ".tiktok.com"}, {"name": "uid_tt", "value": "XXX", "domain": ".tiktok.com"}, {"name": "uid_tt_ss", "value": "XXX", "domain": ".tiktok.com"}, {"name": "sid_tt", "value": "XXX", "domain": ".tiktok.com"}, {"name": "sessionid", "value": "XXX", "domain": ".tiktok.com"}, {"name": "sessionid_ss", "value": "XXX", "domain": ".tiktok.com"}, {"name": "store-idc", "value": "XXX", "domain": ".tiktok.com"}, {"name": "store-country-code", "value": "XXX", "domain": ".tiktok.com"}, {"name": "cmpl_token", "value": "XXX", "domain": ".tiktok.com"}, {"name": "passport_fe_beating_status", "value": "XXX", "domain": ".www.tiktok.com"}, {"name": "odin_tt", "value": "XXX", "domain": ".tiktok.com"}, {"name": "ttwid", "value": "XXX", "domain": ".tiktok.com"}]
The problem might not be correlated with the cookies, but I share it anyways.
What should I do to fix this?
Thanks in advance.