[TikTok, MKV] Replace part of URL using value from a Field?

Hello. For TikTok videos, I have a specific field/MKV tag, UPLOADER_ID, which is the true numeric username, say 01234567890.

So UPLOADER_ID = 01234567890

The URL tag would be for example:

https://www.tiktok.com/@usernameABC/video/1234567890
https://www.tiktok.com/@usernameXYZ/video/0987654321

If possible I would like to replace the part of the URL tag after the @ sign, so from the example above are usernameABC and usernameXYZ to be replaced by the whatever value from the UPLOADER_ID tag.

So after replacement, it would be like:

https://www.tiktok.com/@01234567890/video/1234567890
https://www.tiktok.com/@01234567890/video/0987654321

Thanks in advance.

I tried this:
$regexp('https://www.tiktok.com/@usernameABC/video/1234567890','(.*)/@(.*)/video/.*',$1/@%UPLOADER_ID%/video/%UPLOADER_ID%)
naturally replace the complete URL string with the field name where you find that data.

I think the second example is not quite correct. It should be
https://www.tiktok.com/@0987654321/video/0987654321

Or if I misunderstood that:
$regexp('https://www.tiktok.com/@usernameABC/video/1234567890','(.*)/video/.*',$1/video/%UPLOADER_ID%)

1 Like

Thank you, thank you!:+1:

Is there a way to retain whatever numerical value after the last slash (/) of the URLs? So that only the @usernameABC is replaced by @UPLOADER_ID.

Thanks in advance.

I am still not sure what the source string looks like, which part is a variable one and how the target string should look like.
If it is simply to replace the string @usernameABC with %UPLOADER_ID% the try
$replace(%fieldname%,@usernameABC,%uploader_id%)
I don't know in which field you put the URL that is why I set %fieldname% as dummy name.

Below are real examples from ABC News and E! News respectively:

The real username can be found in the HTML source, in AuthorID, which are saved in MKV (or MKA) as UPLOADER_ID, which are respectively:

  • 6913995869449864197
  • 242840465589526528

Therefore, I only want to replace,

  • @abcnews and
  • @enews

with their respective UPLOADER_ID values which are inside the MKV. So I would like them to become:

  • @6913995869449864197 and
  • @242840465589526528 respectively.

I would like this because the owners of any TikTok accounts can change their friendly nicknames (eg. @abcnews, @enews) anytime, so the URL will become dead if they did so.

Therefore would finally become as:

From your original answer, it works but the trailing numerical values after the last slash were not retained.

So have you tried the bit that simply replaces?

The URL sadly got wholly deleted.

Here's a screenshot of MediaInfo that I would like to replace:

Then you would have to show me, what you did.

Or no, let's try this:
Action of the type "Format value" for URL
$regexp(%url%,'https://www.tiktok.com/@.*/video/(.*)','https://www.tiktok.com/'%uploader_id%'/video/$1')

1 Like

Yehey!:grinning: I only needed to add the @ sign. Hence it became:

$regexp(%url%,'https://www.tiktok.com/@.*/video/(.*)','https://www.tiktok.com/'@%uploader_id%'/video/$1')

I tested the resulting URL, copy-pasted it into the browser's address bar, and it redirected correctly to the friendly nickname URL counterpart (instead of 404). Now, no more "not found" accounts when the owners changed their friendly nicknames.

Thank you, thank you!:+1:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.