the code
"
from TikTokApi import TikTokApi
import os
import uuid
import time
Create the directory to store the videos
if not os.path.exists(‘tiktok_videos’):
os.mkdir(‘tiktok_videos’)
Instantiate the TikTokApi class
api = TikTokApi()
Set the number of videos to crawl
num_videos = 1000
Set the TikTok username or hashtag to crawl
query = ‘funny’
Crawl the videos and save them to the local directory
for i in range(num_videos):
# Get the next batch of videos
videos = api.byUsername(query, count=100)
# Loop through the videos and download them
for video in videos:
# Generate a unique filename for the video
filename = f'{uuid.uuid4()}.mp4'
# Download the video and save it to a file in the specified directory
with open(f'tiktok_videos/{filename}', 'wb') as f:
response = api.get_Video_By_DownloadURL(video['video']['downloadAddr'])
f.write(response.content)
# Print a message to show progress
print(f'Downloaded video {i+1}/{num_videos}')
# If we have downloaded the desired number of videos, break out of the loop
if i+1 == num_videos:
break
# Add a delay to avoid hitting the rate limit
time. Sleep(2)
"
issue “/homes/jl007/.conda/envs/video/lib/python3.10/site-packages/playwright/driver/node: /lib64/libm.so.6: version `GLIBC_2.27’ not found (required by /homes/jl007/.conda/envs/video/lib/python3.10/site-packages/playwright/driver/node)”
how to solve it? Thanks, best wishes