-
Notifications
You must be signed in to change notification settings - Fork 54
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
Request error with slides download #38
Comments
@BillyBSig implemented this part of the code so I'll need to take some time to test it. But that "No schema supplied" error may occur if you omit the "https://" part of the TT URL (e.g. if you use |
I'm using a similar parsing on both video and slides, I want to note that I had no issues with this previously. try:
print(f"Trying to save {i}")
pyk.save_tiktok(i,True)
print("Save successful")
except Exception as e:
print(f"Tiktok save error: {e}") Output:
The issue isn't from the https as it is given in the command input |
OK figured out the problem--the address used for video downloading is blank for slideshows. It'll take me some time to fix it, but if you want to access the data yourself in the meantime, you can find it in the output of |
@dfreelon The error @Lexsah pointed out can also happen for videos. Specifically, when the video url contained in the key I noticed that instead of using the key Watermark Comparison
|
@tomasruizt Hi, I tested your suggestion and just implemented it into the code. Thanks. |
It is not working for slideshow (Ex. https://www.tiktok.com/t/ZTNbTmcdc/). TikTok seems removed the ['webapp.video-detail'] for slideshow post so we can't get the image download url. |
I've been downloading slideshows and their corresponding music reliably for months with code building on top of If you want I can open a PR so that import pyktok as pyk
import requests
# original "https://www.tiktok.com/@trendysxzl/photo/7398323154424171806"
url = "https://www.tiktok.com/@trendysxzl/video/7398323154424171806"
tt_json = pyk.alt_get_tiktok_json(video_url=url)
data_slot = tt_json["__DEFAULT_SCOPE__"]["webapp.video-detail"]["itemInfo"]["itemStruct"]
urls: list[str] = [img["imageURL"]["urlList"][0] for img in data_slot["imagePost"]["images"]]
imgs: list[bytes] = [requests.get(url).content for url in urls]
for idx, img in enumerate(imgs):
with open(f"post/{idx}.jpg", "wb") as f:
f.write(img)
print(f"Saved {idx}.jpg")
audio_url = data_slot["music"]["playUrl"]
if audio_url == "":
print("No audio found!")
else:
audio: bytes = requests.get(audio_url).content
with open("post/audio.mp3", "wb") as f:
f.write(audio)
print("Saved audio.mp3") Note: In my own code I also defensively check the tiktok status_msg: str = tt_json["__DEFAULT_SCOPE__"]["webapp.video-detail"]["statusMsg"]
if status_msg != "ok":
# handle failure |
You have no idea how much this code snippet helped me just now because of the ban time. Thanks a bunch tom 🫡 |
I'll leave this issue open for now, but I'm pausing all Pyktok updates until the platform comes back online in the US. |
Hello,
I updated to the last version (.19) to patch #35.
Video works fine now but slides don't.
I have the following error: Invalid URL '': No schema supplied. Perhaps you meant http://?
Am I the only one having this issue ?
Thanks in advance.
The text was updated successfully, but these errors were encountered: