tiktok-downloader
tiktok-downloader copied to clipboard
I have a suggestion
your code works quite well, is it possible to find 1 api which can download videos in hd format, similar to the api that https://musicaldown.com/en uses, to download videos in hd format? Thank you
Hmm, I didn't even realize that it was possible to get them in a higher resolution. Wonder what would need to be done to do that here...
I thought they were already pretty high in resolution
The ones downloaded using this are in 576x1024, whereas the site he mentioned above allows you to download them at 1080x1920. Would be pretty neat if we could get it to do that.
Tiktoks are also stored at 1080x1920 so it's odd that it gets a lower resolution.
The yt-dl tiktok.py (https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/tiktok.py) is capable of downloading in 1080x1920. I'm not sure I'm smart enough to figure out what they're doing differently in it to get it at 1080x1920, but it would be nice to figure out. If anyone wants to try and implement what they're doing here I would love to help.
I can try to help
Also I couldnt get the scraper to work without loading my own cookies
The yt-dl tiktok.py (https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/tiktok.py) is capable of downloading in 1080x1920. I'm not sure I'm smart enough to figure out what they're doing differently in it to get it at 1080x1920, but it would be nice to figure out. If anyone wants to try and implement what they're doing here I would love to help.
I tried to dig into yt-dl a little, and was actually only able to extracting a 1080p video using OUR current API hostname (api16-normal-c-useast2a.tiktokv.com) with it instead of theirs (api22-normal-c-useast2a.tiktokv.com) which I was only receiving that 576x1024 from that we get already.
I may be missing something in the our API's return block; I'm making requests & looking through the JSON on Postman to test. But in that data I can only find direct links for a couple of the 574p formats, as opposed to ALL of these that show up using our host address on yt-dl:
So I'm a bit more confused than when I started rn. If you wanna try digging into these to see if anything's sitting there you can use "api16-normal-c-useast2a.tiktokv.com/aweme/v1/feed/?aweme_id=[VIDEO_ID]" or "api22-normal-c-useast2a.tiktokv.com/aweme/v1/feed/?aweme_id=[VIDEO_ID]" otherwise I'll try more when I get a chance. Idk much beyond the basics when it comes to APIs themselves, but if it's not directly in the JSON block then maybe someone a little more experienced in Python than myself could look through that yt-dl code a bit more to uncover what they're extracting out of there.
When you swap the endpoint with https://api22-normal-c-useast2a.tiktokv.com/aweme/v1/feed/?aweme_id=${idVideo}
the .mp4s no longer have any content perhaps the video is some kind of bytestring? Also I had to use cookies to get my mass download to work but have you gotten it working without cookies?
I think it's the way they setup their cookies that might be why it works? Another thing; This repo can successfully download all tiktoks, even ones with the sound removed. The yt-dlp program will fail to download tiktoks that have had the sound removed. Not entirely sure why this is, just something I noticed.
It would be interesting to see if we could get someone from that repo that's worked on the tiktok extractor to explain what they are doing specifically to get the higher resolutions.