Repository: yt-dlp/yt-dlp

Issue:
[TikTok] Failed to parse JSON - Can't download videos without watermark 
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Netherlands

### Provide a description that is worded well enough to be understood

Yesterday videos without watermarks were downloading fine, but today videos are only downloading with watermarks. I see that there were issues here about "Failed to parse JSON", but they are all locked and I can't reply in them.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['https://www.tiktok.com/@elias_filmz/video/7344534749551070506', '-vU']
[debug] Encodings: locale cp1251, fs utf-8, pref cp1251, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.03.10.232703 from yt-dlp/yt-dlp-nightly-builds [8463fb510] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19044-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg n6.1.1-1-g61b88b4dda-20240118 (setts), ffprobe n6.1.1-1-g61b88b4dda-20240118
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1803 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.03.10.232703 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.03.10.232703 from yt-dlp/yt-dlp-nightly-builds)
[TikTok] Extracting URL: https://www.tiktok.com/@elias_filmz/video/7344534749551070506
[TikTok] 7344534749551070506: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 1 of 4)
[TikTok] 7344534749551070506: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 2 of 4)
[TikTok] 7344534749551070506: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 3 of 4)
[TikTok] 7344534749551070506: Downloading video feed
WARNING: [TikTok] 7344534749551070506: Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)")); trying with webpage
[TikTok] 7344534749551070506: Downloading webpage
[debug] [TikTok] Found universal data for rehydration
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 7344534749551070506: Downloading 1 format(s): download
[debug] Invoking http downloader on "https://v16-webapp-prime.tiktok.com/video/tos/maliva/tos-maliva-ve-0068c799-us/osDtSSfFIBS7HQEH6fRBEHnD5cmYQgX8gRAQFl/?a=1988&ch=0&cr=3&dr=0&lr=tiktok_m&cd=0%7C0%7C1%7C&cv=1&br=1958&bt=979&bti=ODszNWYuMDE6&cs=0&ds=3&ft=-Csk_mIRPD12NTGunf-Ux412SYKW3wv25NcAp&mime_type=video_mp4&qs=0&rc=aWhlNmdoZDM5ZTU2OGY5M0BpM2VoaW05cjRqcTMzZzczNEA1YS4tNWMuXy0xMTYvLS0tYSNqZmRoMmRjYmpgLS1kMS9zcw%3D%3D&btag=e00090000&expire=1710420583&l=20240314064834E1772D870274A3041055&ply_type=2&policy=2&signature=d63e05bc6e4a2807447d63823426f55f&tk=tt_chain_token"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: Trying to eat breakfast with Bruce! #cow #brucethecow #food #snack #first #animals #foodreview  [7344534749551070506].mp4
[download] 100% of    8.15MiB in 00:00:01 at 4.90MiB/s
```



Discussion:
> I see that there were issues here about "Failed to parse JSON", but they are all locked and I can't reply in them.

This is a legit new issue, though with a familiar error message.

> `Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)"))`

In the past, this problem has manifested due to either the `_APP_VERSIONS` being out-of-date, the `_API_HOSTNAME` needing to be changed/updated, or the endpoint we use adding extra param/header requirements. I've tried some alternatives to our current `_APP_VERSIONS` and `_API_HOSTNAME` without any success. Any help is welcome.
@bashonly Definitely a problem with _API_HOSTNAME. It's just down/broken at the moment. 
If "useast1a" in the API link represents a region, it might even be due to the latest [news ](https://www.bbc.com/news/world-us-canada-68556540 )about the USA wanting to ban Tiktok if they would not sell it to them.
As a temporary workaround `-f 0` downloads videos without watermark. 
Hi
Replace old `_API_HOSTNAME` with `api22-normal-c-useast2a.tiktokv.com`
> Hi Replace old `_API_HOSTNAME` with `api22-normal-c-useast2a.tiktokv.com`

Seems to work fine from my end. Thanks for the suggestion!
@AbdallhMAbd Thanks!

Until this is fixed in master/nightly/stable,
```
--extractor-args "tiktok:api_hostname=api22-normal-c-useast2a.tiktokv.com"
```
can be passed to yt-dlp as a workaround
Hello , Now i donwload video from tiktok with yt-dlp.exe have watermark 


Resolving patch:
diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py
--- a/yt_dlp/extractor/tiktok.py
+++ b/yt_dlp/extractor/tiktok.py
@@ -41,7 +41,7 @@ class TikTokBaseIE(InfoExtractor):
     @property
     def _API_HOSTNAME(self):
         return self._configuration_arg(
-            'api_hostname', ['api16-normal-c-useast1a.tiktokv.com'], ie_key=TikTokIE)[0]
+            'api_hostname', ['api22-normal-c-useast2a.tiktokv.com'], ie_key=TikTokIE)[0]
 
     @staticmethod
     def _create_url(user_id, video_id):


Test patch: