07-30-2025, 12:10 AM
Ok tried again and indeed if I put one video it shows up, but if it's two the post automatically goes blank. I went on a research tangent to understand the problem, and it seems that the issue is with the code which would parse anything between [tiktok] and [/tiktok], and if one puts more than one embed, it will only read the first tag and the closing tag at the end of the entire list swallowing all the urls inside in one single mess. This is specifically a problem with greedy regex .+) or .*)
Possible solutions:
1) Use the first option in the link, which offered a non-greedy regex
But it's still susceptible to possible human error if the url contains spaces or newlines etc.
2) This option will force the parsing of the numerical sequence in the url exclusively (the video ID), which should avoid problems with possible typing mistakes
In both cases what is needed is just the video ID (the numbers at the end of the url)
Possible solutions:
1) Use the first option in the link, which offered a non-greedy regex
Code:
Regular Expression
\[tiktok\](.*?)\[\/tiktok\]
Replacement
<iframe width="560" height="750" src="https://www.tiktok.com/embed/v2/$1" frameborder="0" allowfullscreen></iframe>
But it's still susceptible to possible human error if the url contains spaces or newlines etc.
2) This option will force the parsing of the numerical sequence in the url exclusively (the video ID), which should avoid problems with possible typing mistakes
Code:
Regular Expression
\[tiktok\]\s*([0-9]{8,})\s*\[\/tiktok\]
Replacement
<iframe width="560" height="750" src="https://www.tiktok.com/embed/v2/$1" frameborder="0" allowfullscreen></iframe>
In both cases what is needed is just the video ID (the numbers at the end of the url)
![[Image: abyssw-alker-v0-wx0feo9sd3yod500x100.jpg]](https://i.postimg.cc/LXBKwXgL/abyssw-alker-v0-wx0feo9sd3yod500x100.jpg)
Time goes by but memories rewind