3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pythonでtiktokのデータ取得

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('----------------------------------')
3
3
0

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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?