-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from ezzcodeezzlife/master
π add quickstart.py & more install instructions in readme
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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()) |