It was a grovelling apology. Posting at 4am on the Chinese social network WeChat, Zhang Yiming confessed that he was "filled with remorse and guilt, entirely unable to sleep". His company ByteDance, he explained, had failed to respect the "guidance" of China's powerful state censors and betrayed a "weak" understanding of the theories of Xi Jinping, the Chinese leader.
"All along, we have placed excessive emphasis on the role of technology, and we have not acknowledged that technology must be led by the socialist core value system," he wrote.
Thirty-eight year-old Zhang, the founder of viral video app TikTok's $US100 billion ($144 billion) parent company ByteDance, is China's 10th richest man with a wealth of $US16.2 billion, after TikTok was downloaded more than two billion times. His company is the most valuable start-up in the world.
Zhang announced in his 2018 apology that he would shut down ByteDance's first app, a social network for jokes called Neihan Duanzi, after the Chinese government accused him of hosting "vulgar" content.
Now, running TikTok, the first Chinese app to seriously conquer the west, is a curse as well as a blessing.
It has forced Zhang to flatter two mutually hostile governments and to try to hold together an empire that spans two worlds.
"Any Chinese entrepreneur with a growing product faces the dual pressures of conforming to Chinese law and staying in the good graces of the Chinese Communist Party, while at the same time convincing those outside China that the company is independent of the Chinese government," says Stanley Rosen, a professor of politics at the University of Southern California.
Zhang's life story could easily be that of any US founder. He graduated in 2005 with a degree in software engineering from Nankai University.
Like Mark Zuckerberg, Facebook's founder, he met his wife during his studies. He felt stifled during a stint working at Microsoft and had one failed start-up before founding ByteDance in his Beijing apartment in 2012. His core idea, reportedly gleaned from watching strangers walk about absorbed by their smartphones, was prescient: users were moving en masse from desktop to mobile computers, but contemporary mobile apps made it hard for them to find what they wanted. "I saw that the wave of mobile internet was going to be very, very large," Zhang said in 2018. "In 2007, Apple released the first iPhone. I was shocked when I bought it. I could build a website or write a program on it."
Baidu, China's equivalent of Google, was burning users' trust by making adverts look like real search results.
The solution, Zhang figured, was artificial intelligence (AI) that learned users' preferences as they browsed.
An American venture capital firm, Susquehanna International, gave him a $US5 million funding round, allowing him to launch the app for which ByteDance is still most famous in China.
Toutiao, meaning "headlines", shows its users news stories and learns their interests through its AI. That strategy of picking users' content for them was what supercharged TikTok's growth in the west. Called Douyin in China, the app's first version was built in 200 days and had 100 million users within a year. Zhang himself didn't know what teenagers wanted to see, but he didn't need to: AI could do that job for him.
TikTok requires no input before showing music videos and skits. Instead of picking from a menu of options, users make tiny and often unconscious choices: liking this video, skipping that one, letting another play for a few seconds longer than normal.
Any Chinese entrepreneur with a growing product faces the dual pressures of conforming to Chinese law and staying in the good graces of the Chinese Communist Party, while at the same time convincing those outside China that the company is independent of the Chinese government.
Stanley Rosen, a professor of politics at the University of Southern California
TikTok only achieved major international growth after Zhang acquired Musical.ly, a Shanghai start-up which had attracted more than 200 million users and had opened an office in California.
Zhang's acquisition of Musical.ly was a clear signal that his ambitions weren't limited to China. "Google is a company without borders," Zhang said in 2019. "I hope Toutiao will be as borderless as Google."
But borders would have their revenge. ByteDance has gone global at the precise historical moment that three decades of tightening ties between the Chinese and US economies have begun to unravel.
Mike Pompeo, the US secretary of state, hinted earlier this week that Washington may ban TikTok. The company is fighting to convince US politicians that it's not a threat. In May, Zhang poached high-profile Disney executive Kevin Mayer to become his second in command at ByteDance and the new chief executive of TikTok.
ByteDance has also separated TikTok's technology from its parent company and is seeking a global base for the app outside of China.
But these steps have not eased the concerns of US regulators, who this week launched an investigation into how TikTok handles the data of users aged 13 and under. TikTok's own transparency report found almost a quarter of the videos it took down in 2019's second half involved inappropriate behaviour by minors, from illegal drug use to sexual activity.
"The only permanent solution would be to spin off the overseas entity as a completely separate entity, with an overseas majority shareholder," says Rich Bishop of AppInChina.
Senior executives at ByteDance are discussing options such as creating a new headquarters outside of Beijing and a new management board at TikTok to distance the company from China, according to a report in the Wall Street Journal.
But for now, at least, Zhang has a different route in mind for his company: going public. "Currently, the IPO is not pressing and we don't have any imminent plans," Zhang said earlier this year. "But internally, we are making preparations as if we're working on an IPO."