ProxiTok icon indicating copy to clipboard operation
ProxiTok copied to clipboard

URLify linked profiles in profile description and video descriptions.

Open TrashAccount3424 opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. People often "link" to second accounts in their profile description. People often "link" to other people in the same video in a video description. Currently these "link" are just text with an @ at the beginning for example @joedoe or @Joe Doe but on tiktok these have a URL attached that links to that users profile which my have a different @username than the visible text.

Describe the solution you'd like Would be great if the text has the same HTML links as on tiktok.

Describe alternatives you've considered ¯\_(ツ)_/¯

Here is an example for the behavior https://www.tiktok.com/@nickelback/video/7179767058995907883 The text @Avery Loro links to tiktok.com/@averyloro on tiktok.

TrashAccount3424 avatar Jan 16 '23 17:01 TrashAccount3424

Hi @TrashAccount3424! This has been (partially) implemented with 4188fcf0642bd16174b250f16b819aa9e7bce427

The current implmentation does not work when there's a character like an emoji, because internally PHP treats strings as bytes and gets the length of a string by counting bytes instead of actual unicode characters. This adds an offset that makes the urlify process fail.

I've been trying to find a solution for this but it either doesn't place the links as intended or outputs garbage characters. For now, I've made it return the original description if there is any of those characters while I try to find a solution to it.

pablouser1 avatar Apr 02 '23 18:04 pablouser1

Hi @TrashAccount3424! This has been (partially) implemented with 4188fcf

The current implmentation does not work when there's a character like an emoji, because internally PHP treats strings as bytes and gets the length of a string by counting bytes instead of actual unicode characters. This adds an offset that makes the urlify process fail.

I've been trying to find a solution for this but it either doesn't place the links as intended or outputs garbage characters. For now, I've made it return the original description if there is any of those characters while I try to find a solution to it.

Awesome, much appreciated! Will test it ASAP.

I think grapheme_strlen() is what gives the length as number of Unicode chars. You might need https://www.php.net/manual/en/function.grapheme-extract.php or some other grapheme function which then should work regardless of if such special chars are present or not. I hope this helps, unfortunately this is probably all I can contribute as I do not have any experience in php.

TrashAccount3424 avatar Apr 02 '23 21:04 TrashAccount3424

Hi! Hopefully 80f3ca4ebbc99edd4a9a1109bb9d39f6df84e69e fixed this. I've done some tests and now all hashtags/users are shown properly even with those unicode characters. Please confirm if this also fixes the issue on your side.

pablouser1 avatar Sep 29 '23 11:09 pablouser1