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

Sanitize TikTok URLs #77

Closed
chexxor opened this issue Oct 11, 2022 · 6 comments
Closed

Sanitize TikTok URLs #77

chexxor opened this issue Oct 11, 2022 · 6 comments
Labels
wontfix This will not be worked on

Comments

@chexxor
Copy link

chexxor commented Oct 11, 2022

I think Leon should have a sanitizer for TikTok URLs.

I'm pretty busy, myself, but if I find time, what's the most tricky part of adding a sanitizer? What's the best way to resolve it?

@svenjacobs
Copy link
Owner

Hello @chexxor,

it depends on how TikTok URLs are structured and what needs to be removed. As I don't use TikTok, I have no clue and need user input here 🙂

In most cases a regular expression is sufficient. There are a few examples in this project of sanitizers that use regular expressions.

@chexxor
Copy link
Author

chexxor commented Oct 12, 2022

I found some existing work for it.
https://git.sr.ht/~zethra/tiktok-url-cleaner/tree/main/item/src/main.rs#L85

I'm not familiar with Rust, but I see a web request, so I would guess it's to do short-URL expansion if necessary, or maybe it's to check whether the URL is valid or not.

Anyways, it looks like it just removes all the query parameters after ensuring it's a valid URL.

@chexxor
Copy link
Author

chexxor commented Oct 12, 2022

My friends send links like this to me:
https://www.tiktok.com/t/something/
And my browser expands it to:
https://www.tiktok.com/@user/video/12345678901234567890?_t=something&_r=1

So it must be a short link. We could use a regex to match the URL path in the short-URL, but to resolve it to the final URL and remove tracking parameters, we would need to fetch the expanded URL from TikTok.

Short-URLs can be so nefarious. 😞

@chexxor
Copy link
Author

chexxor commented Oct 12, 2022

TikTok will know that I opened the URL if I use my browser to expand the short-URL, because my browser would send cookies.

One advantage to using Leon to sanitize it is TikTok wouldn't get mg browser cookies, making the URL expansion relatively anonymous.

Then, if I want to further share the URL with my other friends, it's better to share the anonymized URL rather than the original one.

So there's an advantage to using Leon to open TikTok links for myself, and also for my friends with whom I reshare a link.

Related to discussion on Amazon links here: #75

@svenjacobs
Copy link
Owner

As you already found out, there is a similar discussion regarding Amazon short links. Leon would have to perform a HTTP request while currently it can do all the cleaning locally. I still haven't decided whether I like or hate this idea 😉

@svenjacobs svenjacobs added the question Further information is requested label Oct 12, 2022
@svenjacobs
Copy link
Owner

I decided to not implement this because I believe that Leon should stay close to its roots, namely providing privacy by removing tracking and other obsolete parameters. Performing network requests actually reduces privacy because it leaves trails on the server owned by the company, in this case TikTok (ByteDance). If you really want to sanitize these URLs, please unwrap them manually by opening them and then send the unwrapped URL to Leon. If you further want to talk about this, please use this discussion.

@svenjacobs svenjacobs added wontfix This will not be worked on and removed question Further information is requested labels Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants