You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I'm certain this is a simple issue of just passing through my s_v_web_id and tt_chain_token, but I'm having trouble doing so.
Basically the code runs without error, but I get an Access Denied error when trying to download a TikTok Video. What's the work around here?
import io
import glob
import os
import urllib.request
from os import path
import aiohttp
from tiktokapipy.async_api import AsyncTikTokAPI
from tiktokapipy.models.video import Video
link = "https://www.tiktok.com/@prestoneckhardt/video/7203852306889133358"
directory = r"C:\Users\peckh\Desktop\ECKHARDT CAPITAL LLC"
async def save_video(video: Video):
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0;Win64) AppleWebkit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36'}
async with aiohttp.ClientSession() as session:
async with session.get(video.video.download_addr, headers=headers) as resp:
data = await resp.read()
print(data) # print the response data
with open(os.path.join(directory, f'{video.id}.mp4'), 'wb') as f:
f.write(data)
print(f"Video {video.id} has been downloaded.")
async def download_video():
async with AsyncTikTokAPI() as api:
video: Video = await api.video(link)
if video.image_post:
downloaded = await save_slideshow(video)
else:
downloaded = await save_video(video)
asyncio.run(download_video())```
The text was updated successfully, but these errors were encountered:
* Create functions for executing API calls of 4 kinds:
* comment/list/ - video comments
* post/item_list/ - user posts
* challenge/item_list/ - popular videos tagged with a challenge
* related/item_list/ - videos related to this one
* Opens up potential future resolutions for #35, #38, #40, #43, and #44
This may be fixed in version 0.2.4 with the video download function. It doesn't work on slideshows and requires the optional yt-dlp dependency. This can be installed with pip install yt-dlp or pip install tiktokapipy[download]. It may not work 100% depending on where you are, but it works well for me.
Hello. I'm certain this is a simple issue of just passing through my s_v_web_id and tt_chain_token, but I'm having trouble doing so.
Basically the code runs without error, but I get an Access Denied error when trying to download a TikTok Video. What's the work around here?
The text was updated successfully, but these errors were encountered: