forked from sudoguy/tiktokpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quickstart.py
38 lines (29 loc) · 1.2 KB
/
quickstart.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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())