sixem / tiktok-download-buttons

Adds download buttons to the web version of TikTok
https://addons.mozilla.org/en-US/firefox/addon/tiktok-download-buttons/
MIT License
29 stars 2 forks source link

Resolution changes after latest update #20

Open swaglogger opened 3 months ago

swaglogger commented 3 months ago

I noticed before when we had the option to choose between api or blob the resolutions were different. Pre update the checkmark = api

Downloading from api: 720 x 1280

Downloading from blob: 576 x 1024

The bitrates were also different but it seemed like the api download 720 x 1280 always had better quality. Is there a way to get a resolution option added?

Side note: I've also noticed some other bots can download tiktoks in full 1920 x 1080 quality as well. Could this be possible with this addon?

sixem commented 3 months ago

Hi, I talked about this a bit in https://github.com/sixem/tiktok-download-buttons/issues/18#issuecomment-2130595849.

Basically, the API option has been removed because the method it used utilized the mobile API to get different resolutions for a specific ID. This way of getting the API response has been blocked recently by TikTok. Instead, it'll now fetch the video directly from the HTML page or from the web API (a set of JSON data embedded within a script on load).

The web API is different because it basically just contains a singular unwatermarked URL for the browser scripts to use for the video, and it has no variations. So, the script will now look for a valid web API and use that URL. If it doesn't exist, it'll try to get it directly from the HTML (which is often the same URL, just without templating options that we can get from the web API; hence why the templating can sometimes fail if no web API data is found).

I'm aware of third-party websites being able to download higher resolutions, but I think this involves private API keys (where the website acts as a proxy for accessing it) or different methods that don't translate well to an open-source script like this one.

So, regarding your side note, there are third-party APIs that could solve this in theory for this script, but I don't like the idea of depending on third-party APIs for this, as this can be both unsafe and unpredictable. In short, I don't think there's a way of doing this natively anymore using an open-source script, but if anything changes here, then I'll definitely look into it.

Hopefully, this answers your question.