動画はこちら
from tiktokapipy.api import TikTokAPI
import pprint
import os
import logging
logging.basicConfig(filename=os.path.join(os.path.dirname(__file__), "./tiktok.log"), encoding="utf-8",
level=logging.DEBUG)
cur_dir = os.path.dirname(os.path.abspath(__file__))
def search():
creator_list = []
with TikTokAPI() as api:
challenge = api.challenge("ダンス", video_limit=20)
for video in challenge.videos:
logging.info(video.url)
creator_list.append(video.creator._unique_id)
print(creator_list)
def paste_video_html():
"""
<blockquote class="tiktok-embed" style="max-width: 605px; min-width: 325px;" \
cite="https://www.tiktok.com/@{user_id}/video{videoID}" data-video-id="{videoID}"><section></section></blockquote>
<script async src="https://www.tiktok.com/embed.js"></script>
"""
def get_video_info():
with TikTokAPI() as api:
video = api.video("https://m.tiktok.com/v/7299029753250581767")
print(video.desc)
print(video.url)
print(video.id)
print(video.challenges)
print(video.music)
print(video.item_comment_status)
print(video.author)
print([comment.text for comment in video.comments.limit(5)])
print(video.tags._challenge_names)
print(video.creator._unique_id)
print(video.create_time)
print(video.stats.digg_count)
print(video.stats.comment_count)
print(video.stats.play_count)
print(video.video.ratio)
print(video.video.duration)
print(video.video.download_addr)
video.download()
if __name__ == "__main__":
get_video_info()