f2
f2 copied to clipboard
[QUESTION] How to overcome with Access Denied in downloadAddr or playAddr
So, i tried using some test code to download tiktok video. The API seems working well , but I can not access to video url. I do not know whether I did wrong setup or it's a bug Here is my code
import asyncio
import json
from f2.apps.tiktok.handler import TiktokHandler
from f2.apps.tiktok.utils import DeviceIdManager
async def main():
device_ids = await DeviceIdManager.gen_device_ids(1, full_cookie=True)
print(json.dumps(device_ids, indent=4))
kwargs = {
"headers": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0",
"Referer": "https://www.tiktok.com/",
},
"proxies": {"http://": None, "https://": None},
"cookie": device_ids["cookie"][0],
}
video = await TiktokHandler(kwargs).fetch_one_video(itemId="7095819783324601605")
print("=================_to_raw================")
print(video._to_json())
# print("=================_to_dict================")
# print(video._to_dict())
# print("=================_to_list================")
# print(video._to_list())
if __name__ == "__main__":
asyncio.run(main())
Here is the error
You don't have permission to access "http://v16-webapp-prime.tiktok.com/video/tos/useast2a/tos-useast2a-ve-0068c003/f0351788fbbb48829b73ca7d951aec41/?" on this server.
Reference #18.d522ca17.1721691509.2fde4e5e
https://errors.edgesuite.net/18.d522ca17.1721691509.2fde4e5e```