Skip to content

Commit

Permalink
Merge pull request #238 from ezzcodeezzlife/master
Browse files Browse the repository at this point in the history
πŸ‘‹ add quickstart.py & more install instructions in readme
  • Loading branch information
sudoguy authored Apr 27, 2022
2 parents 1656a46 + f8fa0d5 commit 6c4294d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TikTokPy

---

## Quickstart
## Quickstart.py

```python
import asyncio
Expand Down Expand Up @@ -70,3 +70,11 @@ Install browser by playwright
```shell
playwright install chromium
```

If you have little to no knowledge in programming: Read this Guide ["How to use TiktokPy Python Bot"](https://my-tailwind-nextjs-starter-blog.vercel.app/blog/how-to-use-tiktokpy-for-beginner-programmers-indepth-guide) for beginners

## Run

```shell
python quickstart.py
```
35 changes: 35 additions & 0 deletions quickstart.py
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())

0 comments on commit 6c4294d

Please sign in to comment.