davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.88k stars 975 forks source link

[BUG] - Url from video.as_dict returns a 404 link #1195

Open Paul-Manart opened 2 months ago

Paul-Manart commented 2 months ago

Not too sure if it is the package or TikTok changes, but the url provided within video.as_dict no longer returns a video, but a 404 page.

async for video in api.hashtag(name=f"{topic}").videos(count=30, cursor=random.randint(0, 150)):
  video_dict = video.as_dict

  bitrate = video_dict['video']['bitrate']
  for i in video_dict['video']['bitrateInfo']:
      if bitrate == i["Bitrate"]:
          print(i["PlayAddr"]["UrlList"])
          response = requests.get(i["PlayAddr"]["UrlList"][-1])

Specifically, the last link of the UrlList is used to get the video.