Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just Want Text #1114

Open
TebuKanaeru opened this issue Feb 12, 2024 · 0 comments
Open

Just Want Text #1114

TebuKanaeru opened this issue Feb 12, 2024 · 0 comments

Comments

@TebuKanaeru
Copy link

From the script below, can we only get text/comments from the user?

from TikTokApi import TikTokApi
import asyncio
import os

video_id = 7331767529976745234
ms_token = os.environ.get("ms_token", None) # set your own ms_token

context_options = {
'viewport' : { 'width': 1280, 'height': 1024 },
'user_agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36'
}

async def get_comments():
async with TikTokApi() as api:
await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, headless=False)
video = api.video(id=video_id)
count = 0
async for comment in video.comments(count=100):
print(comment)
print(comment.as_dict)

if name == "main":
asyncio.run(get_comments())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant