VOOZH about

URL: https://qiita.com/kou-s/items/8f67c5a97e93cc75371f

⇱ pythonでtiktokのデータ取得 #Python - Qiita


👁 Image
2

Go to list of users who liked

2

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 3 years have passed since last update.

pythonでtiktokのデータ取得

2
Posted at

1. 前提

項目 名前
OS mac os
python python3

2. ライブラリを導入

TikTokApiとplaywrightを入れる

pip install TikTokApi
python3 -m playwright install

3. s_v_web_idを取得

TikTokのページで検証を開いて、
applicationsタブ→cookies→s_v_web_idの値を取得する。
👁 1.png

3. ハッシュタグからユーザーIDとユーザー名を取得する

s_v_web_idをverifyFpに入れて実行する

sample.py
from TikTokApi import TikTokApi
# s_v_web_idをverifyFpに入れる
verifyFp=''
api = TikTokApi.get_instance(custom_verifyFp=verifyFp, use_test_endpoints=True)

# 取得数
count = 1
# ハッシュタグ
hashtag = '切りすぎた'
result = api.by_hashtag(count=count, hashtag=hashtag)

for t in result:
 print('----------------------------------')
 print('ユーザーID : ' + t['author']['uniqueId'])
 print('ユーザー名 : ' + t['author']['nickname'])
 print('----------------------------------')
2

Go to list of users who liked

2
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2

Go to list of users who liked

2