Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiktok下载单个视频报错 #148

Open
hunniman opened this issue Jul 17, 2024 · 2 comments
Open

tiktok下载单个视频报错 #148

hunniman opened this issue Jul 17, 2024 · 2 comments
Labels
提问(question) 想得到更多的详细支持(Further information is requested)

Comments

@hunniman
Copy link

import asyncio

from f2.apps.tiktok.handler import TiktokHandler
from f2.apps.tiktok.utils import SecUserIdFetcher, AwemeIdFetcher
from f2.utils.utils import extract_valid_urls

async def main():
raw_url = (
"https://www.tiktok.com/@niiyamanaoto/video/7374702099826855175?is_from_webapp=1&sender_device=pc"
)
aweme_id= await AwemeIdFetcher.get_aweme_id(raw_url)

print(aweme_id)
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/",
    },
    "cookie": "real cookie xxx",
    "proxies": {"http://": None, "https://": None},
    "url": "https://www.tiktok.com/@niiyamanaoto/video/7374702099826855175?is_from_webapp=1&sender_device=pc",
    "interval": "all",
}

# video = await TiktokHandler(kwargs).fetch_one_video(itemId=aweme_id)
video2 = await TiktokHandler(kwargs).handle_one_video()

if name == "main":
print(asyncio.run(main()))

aweme_id能拿到

ERROR 连接超时错误:
https://v16-webapp-prime.tiktok.com/video/tos/alisg/tos-alisg-pve-0037
/oIbgGIcVweMAmehb2rIQCLsErDvG0A7goQeqyC/?a=1988&bti=ODszNWYuMDE6&ch=0&
cr=3&dr=0&lr=unwatermarked&cd=0%7C0%7C0%7C&cv=1&br=2792&bt=1396&cs=0&d
s=6&ft=I~da4os3D12NvF0hfhIxRG2NglBF-UjNSkopiX&mime_type=video_mp4&qs=0
&rc=MzdnNzc5NjlpNDRpODZkO0BpajRrOXk5cnQ2czMzODgzNEAwYF81MGAxNi4xNWMwLW
I2YSM2Zm5hMmRrYmBgLS1kLy1zcw%3D%3D&btag=e00090000&expire=1721213193&l=
20240717044509437D1B86BF3A11072591&ply_type=2&policy=2&signature=d6c0b
7d347b0e573aef2e8994762d762&tk=tt_chain_token

@hunniman hunniman added the 提问(question) 想得到更多的详细支持(Further information is requested) label Jul 17, 2024
@Johnserf-Seed
Copy link
Owner

需要带headers去请求视频地址,包含ua cookie referer

@SoDam-C
Copy link

SoDam-C commented Oct 30, 2024

请问解决了吗,遇到了同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
提问(question) 想得到更多的详细支持(Further information is requested)
Projects
None yet
Development

No branches or pull requests

3 participants