Giter VIP home page Giter VIP logo

tiktokpy's Introduction

TikTokPy

Tooling that automates your social media interactions to “farm” Likes and Followers on TikTok

Build Status Package version


Quickstart.py

import asyncio
from tiktokpy import TikTokPy


async def main():
    async with TikTokPy() as bot:
        # Do you want to get trending videos? You can!
        trending_items = await bot.trending(amount=5)

        for item in trending_items:
            # ❤️ you can like videos
            await bot.like(item)
            # or unlike them
            await bot.unlike(item)
            # or follow users
            await bot.follow(item.author.username)
            # as and unfollow
            await bot.unfollow(item.author.username)

        # 😏 getting user's feed
        user_feed_items = await bot.user_feed(username="tiktok", amount=5)

        for item in user_feed_items:
            # 🎧 get music title, cover, link, author name..
            print("Music title: ", item.music.title)
            # #️⃣ print all tag's title of video
            print([tag.title for tag in item.challenges])
            # 📈 check all video stats
            print("Comments: ", item.stats.comments)
            print("Plays: ", item.stats.plays)
            print("Shares: ", item.stats.shares)
            print("Likes: ", item.stats.likes)

        # and many other things 😉


asyncio.run(main())

Installation

Install with pip:

pip install tiktokpy

Install browser by playwright

playwright install firefox

Run

To create your cookies and settings.toml file simply run

python quicklogin.py

and then after you login run

python quickstart.py

tiktokpy's People

Contributors

dependabot[bot] avatar ezzcodeezzlife avatar gr3gnov avatar pre-commit-ci[bot] avatar sudoguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tiktokpy's Issues

error code, help me

2021-01-18 15:31:30 | INFO | 🥳 TikTokPy initialized. Version: 0.8.8
2021-01-18 15:31:30 | INFO | 🔧 Settings successfully loaded
2021-01-18 15:31:30 | INFO | ✅ Used cookies of @xxxx._
Traceback (most recent call last):
File "tiktok.py", line 37, in
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "tiktok.py", line 6, in main
async with TikTokPy() as bot:
File "/home/zz/tiktok/tiktokpy/tiktokpy/bot/init.py", line 35, in aenter
await self._init_bot()
File "/home/zz/tiktok/tiktokpy/tiktokpy/bot/init.py", line 98, in _init_bot
self.client: Client = await Client.create()
File "/home/zz/tiktok/tiktokpy/tiktokpy/client/init.py", line 96, in create
self = Client()
File "/home/zz/tiktok/tiktokpy/tiktokpy/client/init.py", line 29, in init
self.cookies = json.loads(settings.get("COOKIES", "[]"))
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

.........

just wanted to say hello since you wont reply me on telegram haha

tiktokpy login fails RuntimeError: Event loop is closed

When I type tiktokpy login and log in tiktok website I do get this error. I see that the opened browser is trying to access the profile and it displays error loading on tiktok website, maybe it is related?

C:\Users\elblo\Desktop>tiktokpy login
2020-09-06 13:54:45 | INFO | 🥳 TikTokPy initialized. Version: 0.8.6
2020-09-06 13:54:46 | INFO | 🔧 Settings successfully loaded
2020-09-06 13:54:46 | INFO | 🛑 Cookies not found, anonymous mode
2020-09-06 13:54:50 | INFO | ✋ TikTokPy finished working. Session lasted: 4 seconds
Traceback (most recent call last):
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\elblo\AppData\Local\Programs\Python\Python38-32\Scripts\tiktokpy.exe\__main__.py", line 7, in <module>
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\typer\main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\typer\main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\tiktokpy\cli\utils.py", line 8, in wrapper
    return asyncio.run(f(*args, **kwargs))
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\tiktokpy\cli\__init__.py", line 13, in login
    await bot.login_session()
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\tiktokpy\bot\__init__.py", line 85, in login_session
    await Login().manual_login()
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\tiktokpy\client\login.py", line 18, in manual_login
    await page.waitForSelector(".profile", options={"timeout": 0})
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\pyppeteer\frame_manager.py", line 853, in __await__
    result = yield from self.promise
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\pyppeteer\frame_manager.py", line 875, in rerun
    success = await context.evaluateHandle(
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\pyppeteer\execution_context.py", line 108, in evaluateHandle
    _rewriteError(e)
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\pyppeteer\execution_context.py", line 238, in _rewriteError
    raise error
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\pyppeteer\execution_context.py", line 99, in evaluateHandle
    _obj = await self._client.send('Runtime.callFunctionOn', {
pyppeteer.errors.NetworkError: Protocol error Runtime.callFunctionOn: Target closed.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\site-packages\pyppeteer\launcher.py", line 151, in _close_process
    self._loop.run_until_complete(self.killChrome())
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\asyncio\base_events.py", line 591, in run_until_complete
    self._check_closed()
  File "c:\users\elblo\appdata\local\programs\python\python38-32\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
sys:1: RuntimeWarning: coroutine 'Launcher.killChrome' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Cannot Scrape Username

Already install and follow guide.

for item in user_feed_items:
  # 🎧 get music title, cover, link, author name..
  print("Music title: ", item.music.title)
  # #️⃣ print all tag's title of video
  print([tag.title for tag in item.challenges])
  # 📈 check all video stats
  print("Comments: ", item.stats.comments)
  print("Plays: ", item.stats.plays)
  print("Shares: ", item.stats.shares)
  print("Likes: ", item.stats.likes)

but gettin' error:
image

can u give advice sir? thank you.

Help to use

Anybody can help me how to use this tools?

pending on 'Getting trending items'

Hi!
The code id pending on 'Getting trends':

2021-04-18 17:26:07 | INFO | 🥳 TikTokPy initialized. Version: 0.8.9
2021-04-18 17:26:07 | INFO | 🔧 Settings in path directory not found "...". I'll create default settings here: ///
2021-04-18 17:26:07 | INFO | 🔧 Settings successfully loaded
2021-04-18 17:26:07 | INFO | 🛑 Cookies not found, anonymous mode
100%|██████████████████████████████████████████████████████████████| 136913619/136913619 [00:11<00:00, 11954654.37it/s]
2021-04-18 17:26:22 | INFO | 📈 Getting trending items

Could you please clarify, how the authentication is passed? Where I can specify login data?

Thanks!

How to login?

How to actually login?
It is not in quickstart. Is it possible to include the login command before the other functions in quickstart?

Help how to start it

the code after i run it it just gives === Restart " bot script path"
can anyone help me fix this ?

Functions

Hello, I can't seem to find the functions to
Login
Getfollowers
Getfollowing

How the fuck do you use it???!?!?!??!?

How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?How the fuck do you use it???!?!?!??!?

how the fuck do we use this

how the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use thishow the fuck do we use this

Project actually work? / still alive? i get a strange error

I installed but i get this error, is normal?

python3 '/home/ma/Scrivania/tiktok/tiktokbot (copia).py'
2021-02-13 11:57:13 | INFO | 🥳 TikTokPy initialized. Version: 0.8.9
2021-02-13 11:57:13 | INFO | 🔧 Settings successfully loaded
2021-02-13 11:57:13 | INFO | 🛑 Cookies not found, anonymous mode
2021-02-13 11:57:13 | INFO | 📈 Getting trending items
📈 Getting trending EN: 0%| | 0/5 [00:00<?, ?it/s]2021-02-13 11:57:19 | INFO | ✋ TikTokPy finished working. Session lasted: 6 seconds
Traceback (most recent call last):
File "/home/ma/Scrivania/tiktok/tiktokbot (copia).py", line 37, in
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/ma/Scrivania/tiktok/tiktokbot (copia).py", line 8, in main
trending_items = await bot.trending(amount=5)
File "/home/ma/.local/lib/python3.8/site-packages/tiktokpy/bot/init.py", line 57, in trending
items = await Trending(client=self.client).feed(amount=amount, lang=lang)
File "/home/ma/.local/lib/python3.8/site-packages/tiktokpy/client/trending.py", line 41, in feed
await page.evaluate(
File "/home/ma/.local/lib/python3.8/site-packages/pyppeteer/page.py", line 1184, in evaluate
return await frame.evaluate(pageFunction, *args, force_expr=force_expr)
File "/home/ma/.local/lib/python3.8/site-packages/pyppeteer/frame_manager.py", line 308, in evaluate
return await context.evaluate(
File "/home/ma/.local/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 53, in evaluate
handle = await self.evaluateHandle(
File "/home/ma/.local/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 92, in evaluateHandle
raise ElementHandleError(
pyppeteer.errors.ElementHandleError: Evaluation failed: TypeError: Cannot read property 'scrollIntoView' of null
at pyppeteer_evaluation_script:3:21
📈 Getting trending EN: 0%|

pyppeteer.errors.PageError: net::ERR_INVALID_RESPONSE at https://www.tiktok.com/foryou?lang=en

when i run the given example from readme:

import asyncio
from tiktokpy import TikTokPy


async def main():
    async with TikTokPy() as bot:
        # Do you want to get trending videos? You can!
        trending_items = await bot.trending(amount=5)

        for item in trending_items:
            # ❤️ you can like videos
            await bot.like(item)
            # or unlike them
            await bot.unlike(item)
            # or follow users
            await bot.follow(item.author.username)
            # as and unfollow
            await bot.unfollow(item.author.username)

        # 😏 getting user's feed
        user_feed_items = await bot.user_feed(username="justinbieber", amount=5)

        for item in user_feed_items:
            # 🎧 get music title, cover, link, author name..
            print("Music title: ", item.music.title)
            # #️⃣ print all tag's title of video
            print([tag.title for tag in item.challenges])
            # 📈 check all video stats
            print("Comments: ", item.stats.comments)
            print("Plays: ", item.stats.plays)
            print("Shares: ", item.stats.shares)
            print("Likes: ", item.stats.likes)

        # and many other things 😉

asyncio.run(main())

i get this error:

2021-11-28 20:27:07 | INFO | 🥳 TikTokPy initialized. Version: 0.8.9
2021-11-28 20:27:07 | INFO | 🔧 Settings successfully loaded
2021-11-28 20:27:07 | INFO | 🛑 Cookies not found, anonymous mode
2021-11-28 20:27:08 | INFO | 📈 Getting trending items
2021-11-28 20:27:08 | INFO | ✋ TikTokPy finished working. Session lasted: a second
Traceback (most recent call last):
  File "C:\Users\pc\Desktop\tiktokbot\quickstart.py", line 37, in <module>
    asyncio.run(main())
  File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Users\pc\Desktop\tiktokbot\quickstart.py", line 8, in main
    trending_items = await bot.trending(amount=5)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\tiktokpy\bot\__init__.py", line 57, in trending
    items = await Trending(client=self.client).feed(amount=amount, lang=lang)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\tiktokpy\client\trending.py", line 26, in feed
    _ = await self.client.goto(
  File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\tiktokpy\client\__init__.py", line 87, in goto
    return await page.goto(full_url, *args, **kwargs)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\pyppeteer\page.py", line 879, in goto
    raise PageError(result)
pyppeteer.errors.PageError: net::ERR_INVALID_RESPONSE at https://www.tiktok.com/foryou?lang=en

how can i fix it?

Any way to contribute to this project?

I would like to contribute to this project via Pull Request or other methods.
I have implemented a method to retrieve the followed users and follow/unfollow lists of usernames instead of the single call, because doing more than 10 single calls opens too many instances of chromium and cpu usage goes to 100%.
I also would like to add the log level in the TikTokPy constructor

I copy the tiktok cookie after login tiktok website,not work

I copy the cookie after I login the tiktok website with chrome and
paste it on settings.toml but it got error,
Traceback (most recent call last):
File "tiktok.py", line 37, in
File "/usr/local/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "tiktok.py", line 6, in main
File "/home/august/venv3.8/lib/python3.8/site-packages/tiktokpy/bot/init.py", line 27, in init
load_or_create_settings(path=settings_path)
File "/home/august/venv3.8/lib/python3.8/site-packages/tiktokpy/utils/settings.py", line 30, in load_or_create_settings
settings.load_file(path=path)
File "/home/august/venv3.8/lib/python3.8/site-packages/dynaconf/utils/parse_conf.py", line 206, in evaluate
value = f(settings, *args, **kwargs)
File "/home/august/venv3.8/lib/python3.8/site-packages/dynaconf/base.py", line 142, in getattr
self._setup()
File "/home/august/venv3.8/lib/python3.8/site-packages/dynaconf/base.py", line 184, in _setup
default_settings.reload(self._kwargs.get("load_dotenv"))
File "/home/august/venv3.8/lib/python3.8/site-packages/dynaconf/default_settings.py", line 71, in reload
start_dotenv(*args, **kwargs)
File "/home/august/venv3.8/lib/python3.8/site-packages/dynaconf/default_settings.py", line 57, in start_dotenv
or _find_file(".env", project_root=root_path)
File "/home/august/venv3.8/lib/python3.8/site-packages/dynaconf/utils/files.py", line 54, in find_file
script_dir = os.path.dirname(os.path.abspath(inspect.stack()[-1].filename))
File "/usr/local/lib/python3.8/inspect.py", line 1514, in stack
return getouterframes(sys._getframe(1), context)
File "/usr/local/lib/python3.8/inspect.py", line 1491, in getouterframes
frameinfo = (frame,) + getframeinfo(frame, context)
File "/usr/local/lib/python3.8/inspect.py", line 1465, in getframeinfo
lines, lnum = findsource(frame)
File "/usr/local/lib/python3.8/inspect.py", line 794, in findsource
lines = linecache.getlines(file, module.dict)
File "/usr/local/lib/python3.8/linecache.py", line 47, in getlines
return updatecache(filename, module_globals)
File "/usr/local/lib/python3.8/linecache.py", line 137, in updatecache
lines = fp.readlines()
File "/usr/local/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 558: invalid continuation byte

bot reporting it is working but when I check my likes/following it does not actually do anything

Hey I have the bot up and running but it dosnt actually do anything although it says it is working:

2021-02-09 22:23:42 | INFO | 📈 Getting trending items
📈 Getting trending EN: 100%|██████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 1249.87it/s]
2021-02-09 22:23:46 | INFO | 📹 Found 5 videos
2021-02-09 22:23:46 | INFO | 🧭 Going to @timothytancre's video 6925302735428422917 page for like
2021-02-09 22:23:51 | INFO | 👍 @timothytancre's video 6925302735428422917 liked
2021-02-09 22:23:51 | INFO | 🧭 Going to @timothytancre's page for following
2021-02-09 22:23:58 | INFO | ➕ @timothytancre followed
2021-02-09 22:23:58 | INFO | 🧭 Going to @tiakbhatia's video 6917690109928295685 page for like
2021-02-09 22:24:02 | INFO | 👍 @tiakbhatia's video 6917690109928295685 liked
2021-02-09 22:24:03 | INFO | 🧭 Going to @tiakbhatia's page for following

Get "You are visiting our service too frequently." when try to login for the first time

Get this error when i try to login:

"You are visiting our service too frequently."

Even try to paste the cookies for my chrome browser, but get this error:

File "/usr/local/bin/tiktokpy", line 8, in <module>
   sys.exit(app())
 File "/usr/local/lib/python3.8/site-packages/typer/main.py", line 214, in __call__
   return get_command(self)(*args, **kwargs)
 File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
   return self.main(*args, **kwargs)
 File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
   rv = self.invoke(ctx)
 File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
   return _process_result(sub_ctx.command.invoke(sub_ctx))
 File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
   return ctx.invoke(self.callback, **ctx.params)
 File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
   return callback(*args, **kwargs)
 File "/usr/local/lib/python3.8/site-packages/typer/main.py", line 497, in wrapper
   return callback(**use_params)  # type: ignore
 File "/usr/local/lib/python3.8/site-packages/tiktokpy/cli/utils.py", line 8, in wrapper
   return asyncio.run(f(*args, **kwargs))
 File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 44, in run
   return loop.run_until_complete(main)
 File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
   return future.result()
 File "/usr/local/lib/python3.8/site-packages/tiktokpy/cli/__init__.py", line 12, in login
   async with TikTokPy() as bot:
 File "/usr/local/lib/python3.8/site-packages/tiktokpy/bot/__init__.py", line 27, in __init__
   load_or_create_settings(path=settings_path)
 File "/usr/local/lib/python3.8/site-packages/tiktokpy/utils/settings.py", line 30, in load_or_create_settings
   settings.load_file(path=path)
 File "/usr/local/lib/python3.8/site-packages/dynaconf/base.py", line 141, in __getattr__
   self._setup()
 File "/usr/local/lib/python3.8/site-packages/dynaconf/base.py", line 191, in _setup
   self._wrapped = Settings(
 File "/usr/local/lib/python3.8/site-packages/dynaconf/base.py", line 255, in __init__
   self.execute_loaders()
 File "/usr/local/lib/python3.8/site-packages/dynaconf/base.py", line 947, in execute_loaders
   settings_loader(
 File "/usr/local/lib/python3.8/site-packages/dynaconf/loaders/__init__.py", line 124, in settings_loader
   loader["loader"].load(
 File "/usr/local/lib/python3.8/site-packages/dynaconf/loaders/toml_loader.py", line 31, in load
   loader.load(filename=filename, key=key, silent=silent)
 File "/usr/local/lib/python3.8/site-packages/dynaconf/loaders/base.py", line 62, in load
   source_data = self.get_source_data(files)
 File "/usr/local/lib/python3.8/site-packages/dynaconf/loaders/base.py", line 83, in get_source_data
   content = self.file_reader(open_file)
 File "/usr/local/lib/python3.8/site-packages/dynaconf/vendor/toml/decoder.py", line 83, in load
   try:return loads(f.read(),B,A)
 File "/usr/local/lib/python3.8/site-packages/dynaconf/vendor/toml/decoder.py", line 97, in loads
   if E==_G:raise TomlDecodeError('Key name found without value. Reached end of line.',I,A)
dynaconf.vendor.toml.decoder.TomlDecodeError: Key name found without value. Reached end of line. (line 216 column 2 char 4996)

Maybe settings.toml isn't write? I just copy the cookie file and place it after this code:

[default]
BASE_URL = "https://www.tiktok.com/"
HEADLESS = true
LANG = "en"
HOME_DIR = "/Users/xxx"

SSL issue when running Quickstart

MacBook-Pro:Desktop$ python3 tikapi.py 
2020-09-09 11:15:34 | INFO | 🥳 TikTokPy initialized. Version: 0.8.6
2020-09-09 11:15:34 | INFO | 🔧 Settings successfully loaded
2020-09-09 11:15:34 | INFO | 🛑 Cookies not found, anonymous mode
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connection.py", line 360, in connect
    ssl_context=context,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tikapi.py", line 28, in <module>
    asyncio.run(main())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
    return future.result()
  File "tikapi.py", line 6, in main
    async with TikTokPy() as bot:
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tiktokpy/bot/__init__.py", line 35, in __aenter__
    await self._init_bot()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tiktokpy/bot/__init__.py", line 98, in _init_bot
    self.client: Client = await Client.create()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tiktokpy/client/__init__.py", line 101, in create
    await self.init_browser(headless=headless)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tiktokpy/client/__init__.py", line 44, in init_browser
    self.browser: Browser = await launch(**params)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/launcher.py", line 305, in launch
    return await Launcher(options, **kwargs).launch()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/launcher.py", line 119, in __init__
    download_chromium()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/chromium_downloader.py", line 146, in download_chromium
    extract_zip(download_zip(get_url()), DOWNLOADS_FOLDER / REVISION)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/chromium_downloader.py", line 85, in download_zip
    data = http.request('GET', url, preload_content=False)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/request.py", line 76, in request
    method, url, fields=fields, headers=headers, **urlopen_kw
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/request.py", line 97, in request_encode_url
    return self.urlopen(method, url, **extra_kw)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/poolmanager.py", line 330, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 760, in urlopen
    **response_kw
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 760, in urlopen
    **response_kw
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 760, in urlopen
    **response_kw
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='storage.googleapis.com', port=443): Max retries exceeded with url: /chromium-browser-snapshots/Mac/588429/chrome-mac.zip (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))

It says it's following people but it's not

So I managed to get it running.
The scripts apparently works smoothly, saying it's going to people's page and following them.
But when I check my profile, nothing actually happened. My following list did not change.

Bot need update didn`t do the actions

Bot run but don`t do the actions

2022-04-01 14:42:45 | INFO | 📹 Found 3 videos 2022-04-01 14:42:45 | INFO | 🧭 Going to @ogisimeonov's video 7053820857914903814 page for like 2022-04-01 14:42:52 | INFO | 👍 @ogisimeonov's video 7053820857914903814 liked 2022-04-01 14:42:52 | INFO | 🧭 Going to @ogisimeonov's page for following 2022-04-01 14:43:00 | INFO | ➕ @ogisimeonov followed 2022-04-01 14:43:00 | INFO | 🧭 Going to @stoyan_yordanov1991's video 7074817726203596037 page for like 2022-04-01 14:43:11 | INFO | 👍 @stoyan_yordanov1991's video 7074817726203596037 liked 2022-04-01 14:43:11 | INFO | 🧭 Going to @stoyan_yordanov1991's page for following 2022-04-01 14:43:20 | INFO | ➕ @stoyan_yordanov1991 followed 2022-04-01 14:43:20 | INFO | 🧭 Going to @lilytihova's video 7051539740046249222 page for like 2022-04-01 14:43:26 | INFO | 👍 @lilytihova's video 7051539740046249222 liked 2022-04-01 14:43:26 | INFO | 🧭 Going to @lilytihova's page for following 2022-04-01 14:43:33 | INFO | ➕ @lilytihova followed 2022-04-01 14:43:33 | INFO | ✋ TikTokPy finished working. Session lasted: a minute

This is the log when i observe in tiktok no actions are executed.
Probably need update I try to look around in the code but I am 0 with asyco and not very good at python.So if the owner of the repo or some contributor have a time to update the bot will be great.

How to solve this?

Hi, trying out this bot. I'm facing some problems:

Traceback (most recent call last):
File "quickstart.py", line 34, in
asyncio.run(main())
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "quickstart.py", line 6, in main
async with TikTokPy() as bot:
File "/home/pi/.local/lib/python3.7/site-packages/tiktokpy/bot/init.py", line 35, in aenter
await self._init_bot()
File "/home/pi/.local/lib/python3.7/site-packages/tiktokpy/bot/init.py", line 98, in _init_bot
self.client: Client = await Client.create()
File "/home/pi/.local/lib/python3.7/site-packages/tiktokpy/client/init.py", line 97, in create
await self.init_browser(headless=headless)
File "/home/pi/.local/lib/python3.7/site-packages/tiktokpy/client/init.py", line 42, in init_browser
self.browser: Browser = await launch(**params)
File "/home/pi/.local/lib/python3.7/site-packages/pyppeteer/launcher.py", line 305, in launch
return await Launcher(options, **kwargs).launch()
File "/home/pi/.local/lib/python3.7/site-packages/pyppeteer/launcher.py", line 147, in launch
self.cmd, **options, )
File "/usr/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/pi/.local/share/pyppeteer/local-chromium/588429/chrome-linux/chrome'

I'm running on Raspberry Pi3. Is there any way to use Firefox?

Stuck on liking picture

Hi there, Thank you so much for sharing the library, i have a problem though, the bottom half of the example code works fine, but when i try to call the like function, it gets stuck at "Going to @ video page for like". how do i solve this, Thanks!

[RuntimeError] Bot wont work,

2020-08-15 12:49:59 | INFO | ✅ Used cookies of @SomeRandomGuy
2020-08-15 12:50:36 | INFO | ✋ TikTokPy finished working. Session lasted: 36 seconds
Traceback (most recent call last):
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return run_code(code, main_globals, None,
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\SomeRandomGuy\AppData\Local\Programs\Python\Python38\Scripts\tiktokpy.exe_main
.py", line 7, in
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\typer\main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 829, in call
return self.main(*args, **kwargs)
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1259, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\typer\main.py", line 497, in wrapper
return callback(**use_params) # type: ignore
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\tiktokpy\cli\utils.py", line 8, in wrapper
return asyncio.run(f(*args, **kwargs))
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\tiktokpy\cli_init
.py", line 13, in login
await bot.login_session()
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\tiktokpy\bot_init
.py", line 83, in login_session
await Login().manual_login()
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\tiktokpy\client\login.py", line 21, in manual_login
await page.waitFor(".profile-actions > li:first-child")
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\pyppeteer\frame_manager.py", line 855, in await
raise result
pyppeteer.errors.TimeoutError: Waiting for selector ".profile-actions > li:first-child" failed: timeout 30000ms exceeds.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\site-packages\pyppeteer\launcher.py", line 151, in _close_process
self._loop.run_until_complete(self.killChrome())
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 591, in run_until_complete
self._check_closed()
File "c:\users\SomeRandomGuy\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
sys:1: RuntimeWarning: coroutine 'Launcher.killChrome' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

C:\Users\SomeRandomGuy\Desktop\TikTok\tiktokpy-master>

Unable to follow

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.

Error

kts@HP-Laptop:~/Scrivania$ python3 TikTok.py
2021-04-25 10:29:41 | INFO | 🥳 TikTokPy initialized. Version: 0.8.9
2021-04-25 10:29:41 | INFO | 🔧 Settings successfully loaded
2021-04-25 10:29:41 | INFO | 🛑 Cookies not found, anonymous mode
2021-04-25 10:29:41 | INFO | 📈 Getting trending items
📈 Getting trending EN: 0%| | 0/5 [00:00<?, ?it/s]2021-04-25 10:29:47 | INFO | ✋ TikTokPy finished working. Session lasted: 6 seconds
Traceback (most recent call last):
File "TikTok.py", line 37, in
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "TikTok.py", line 8, in main
trending_items = await bot.trending(amount=5)
File "/home/kts/.local/lib/python3.8/site-packages/tiktokpy/bot/init.py", line 57, in trending
items = await Trending(client=self.client).feed(amount=amount, lang=lang)
File "/home/kts/.local/lib/python3.8/site-packages/tiktokpy/client/trending.py", line 41, in feed
await page.evaluate(
File "/home/kts/.local/lib/python3.8/site-packages/pyppeteer/page.py", line 1184, in evaluate
return await frame.evaluate(pageFunction, *args, force_expr=force_expr)
File "/home/kts/.local/lib/python3.8/site-packages/pyppeteer/frame_manager.py", line 308, in evaluate
return await context.evaluate(
File "/home/kts/.local/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 53, in evaluate
handle = await self.evaluateHandle(
File "/home/kts/.local/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 92, in evaluateHandle
raise ElementHandleError(
pyppeteer.errors.ElementHandleError: Evaluation failed: TypeError: Cannot read property 'scrollIntoView' of null
at pyppeteer_evaluation_script:3:21
📈 Getting trending EN: 0%|

ERROR - Tried to run the sample code and it won't work

Hey, so i'm trying to run the sample code given in the README, but most of the time it just prints
2022-03-04 12:21:03 | INFO | 🥳 TikTokPy initialized. Version: 0.9.0
2022-03-04 12:21:03 | INFO | 🔧 Settings successfully loaded
2022-03-04 12:21:03 | INFO | 🛑 Cookies not found, anonymous mode
2022-03-04 12:21:04 | INFO | 📈 Getting trending items
📈 Getting trending EN: 0%| | 0/5 [00:00<?, ?it/s]
and then the number 00:00 counts up in seconds but the bar never fills up at all, and i never actually get the trending page.

Every once in a while, instead, it will get the trending page and then tell me:
2022-03-04 13:59:35 | INFO | 📹 Found 5 videos
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-03-04 13:59:35 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login

I've tried running "tiktokpy login" in the console and it opened a popup on tiktoks website asking me to log in, when i do, it logs me in and then quickly closes the window. In the command line it prints this, the first half before logging in and the second half after:
2022-03-04 14:02:18 | INFO | 🥳 TikTokPy initialized. Version: 0.9.0
2022-03-04 14:02:18 | INFO | 🔧 Settings successfully loaded
2022-03-04 14:02:18 | INFO | 🛑 Cookies not found, anonymous mode

2022-03-04 14:03:27 | INFO | 🔑 Logged as @XXXX aka XXXX
2022-03-04 14:03:28 | INFO | ✋ TikTokPy finished working. Session lasted: a minute
/Users/XXXX/.XXXX/XXXX/XXXX/lib/python3.7/asyncio/unix_events.py:878: RuntimeWarning: A loop is being detached from a child watcher with pending handlers RuntimeWarning)
That doesn't seem to affect what happens when I run the code, which still won't work. Not sure what to do with this, and can't find docs anywhere for the API, can anybody set me on the right path?

In order to run the sample code, i didn't edit it at all except for putting if __name__ == '__main__': above the line asyncio.run(main()) so i can run it.

TypeError: 'coroutine' object is not iterable

(toks) 11:59 ~/code/toks (master)$ python
Python 3.8.0 (default, Nov 14 2019, 22:29:45) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> from tiktokpy import TikTokPy
>>> 
>>> 
>>> async def main():
...     async with TikTokPy() as bot:
...         user_feed_items = TikTokPy().user_feed(username="bfeldman89", amount=5)
...         for item in user_feed_items:
...             print("Plays: ", item.stats.plays)
...             print("Shares: ", item.stats.shares)
...             print("Likes: ", item.stats.likes)
... 
>>> 
>>> asyncio.run(main())
2021-07-17 12:01:13 | INFO | 🥳 TikTokPy initialized. Version: 0.8.9
2021-07-17 12:01:14 | INFO | 🔧 Settings successfully loaded
2021-07-17 12:01:14 | INFO | 🛑 Cookies not found, anonymous mode
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 108773488/108773488 [00:00<00:00, 264727549.24it/s]
2021-07-17 12:01:27 | INFO | 🥳 TikTokPy initialized. Version: 0.8.9
2021-07-17 12:01:27 | INFO | 🔧 Settings successfully loaded
2021-07-17 12:01:27 | INFO | 🛑 Cookies not found, anonymous mode
2021-07-17 12:01:27 | INFO | ✋ TikTokPy finished working. Session lasted: 14 seconds
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "<stdin>", line 4, in main
TypeError: 'coroutine' object is not iterable

Issue over getting feed and doing action (liking, following, etc)

Hello, thanks for the bot, the concept and the usage feel pretty good.

But i found some issue whenever i try to get trending item and sending action, the script just stopped responding on

2020-11-13 07:39:16 | INFO | 🧭 Going to @ someuser video 1236817212736 page for like

Also whenever i try to get info form certain feed it just stuck on

2020-11-13 07:56:09 | INFO | 📈 Getting @ somuser feed

TikTokPy gets stuck after start-up.

Hi @sudoguy,
How it's going?
I've tried to play around with the library for a little bit today. However, it does not seem to function properly for me.
I have copied the code you've written in the README file and it just seems to get stuck at "Getting Trending Items..":

2020-09-06 18:03:25 | INFO | 🥳 TikTokPy initialized. Version: 0.8.6
2020-09-06 18:03:26 | INFO | 🔧 Settings successfully loaded
2020-09-06 18:03:26 | INFO | 🛑 Cookies not found, anonymous mode
2020-09-06 18:03:26 | INFO | 📈 Getting trending items

Am I doing anything wrong?
I've tried using other functions as well but they all freeze after the program starts-up.

Thank you very much,
RoyIL

could not create user name

ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login ,error correction instructions, thanks

Anyone explain me how to use?

When I start the bot or another .py say somenthing like =RESTARD..... ; and idk how to use the quickstart is weird for me

Cookies not saved

2022-04-06 15:23:54 | INFO | 🥳 TikTokPy initialized. Version: 0.9.0
2022-04-06 15:23:54 | INFO | 🔧 Settings successfully loaded
2022-04-06 15:23:54 | INFO | 🛑 Cookies not found, anonymous mode
2022-04-06 15:23:55 | INFO | 📈 Getting trending items
📈 Getting trending EN: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:03<00:00, 1.56it/s]
2022-04-06 15:24:17 | INFO | 📹 Found 5 videos
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "like" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unlike" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "follow" without login! Run "tiktokpy login" first and do login
2022-04-06 15:24:17 | ERROR | 😡 You cannot use function "unfollow" without login! Run "tiktokpy login" first and do login

pip tiktokpy not found

when i run

pip install tiktokpy

i get this error:

ERROR: Could not find a version that satisfies the requirement tiktokpy (from versions: none)

ERROR: No matching distribution found for tiktokpy

Cant Login

Hello Guys, i cant login , why dont working? Can Please help me

C:\Users\Konta\Desktop\TikTokBot\tiktokpy-master>tiktokpy login
Traceback (most recent call last):
  File "C:\Users\Konta\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Konta\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Konta\AppData\Local\Programs\Python\Python310\Scripts\tiktokpy.exe\__main__.py", line 4, in <module>
    from tiktokpy.cli import app
  File "C:\Users\Konta\AppData\Local\Programs\Python\Python310\lib\site-packages\tiktokpy\cli\__init__.py", line 1, in <module>
    import typer
  File "C:\Users\Konta\AppData\Local\Programs\Python\Python310\lib\site-packages\typer\__init__.py", line 12, in <module>
    from click.termui import get_terminal_size as get_terminal_size
ImportError: cannot import name 'get_terminal_size' from 'click.termui' (C:\Users\Konta\AppData\Local\Programs\Python\Python310\lib\site-packages\click\termui.py)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.