davidteather / TikTokBot

A TikTokBot that downloads trending tiktok videos and compiles them using FFmpeg
Other
347 stars 61 forks source link

How to target hashtag instead of trend? #6

Closed Lem0nTree closed 4 years ago

Lem0nTree commented 4 years ago

Hello, I really appreciate your work, it's a really good project :D

I noticed that it download the same videos over time, even with days apart, so i wish to make possible to target specific hashtag where to download videos.

I saw in your tiktokapi that you created a specific _api.search_byhashtag(hashtag, count=10), but in this bot looks like the scraping process is managed by # Vars count = 42 val = True while val is True: url = "https://m.tiktok.com/share/item/list?id=&type=5&count=" + \ str(count) + "&minCursor=10&maxCursor=10&_signature=" + "W5cHbxAVBvNS2316KIvp21uXB3" Any hint on how to manage the scraping process with you api instead that this url request? Thank you for your time, i really appreciate that!

👊 @davidteather

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.78. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

davidteather commented 4 years ago

Hey there you can check out the davidteather/TikTok-Api


from TikTokApi import TikTokapi

# Starts The Api Class
api = TikTokapi("browsermob-proxy/bin/browsermob-proxy")

# The Number of trending TikToks you want to be displayed
results = 10

# Gets trending hashtags
trending_tags = api.get_trending_hashtags()

# Searches for the top trending hashtag of TikTok
result = api.search_by_hashtag(trending_tags[0])

# just replace the trending_tags[0] with any hashtag you want. Ex: “funny”

for tiktok in result:
    # Prints the text of the tiktok
    print(tiktok['itemInfos']['text'])

print(len(result))