Repository: yt-dlp/yt-dlp

Issue:
[LiTV] Not able to download member only content with cookies
### 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

Taiwan

### Provide a description that is worded well enough to be understood

Got "ERROR: [LiTV] VOD00299822: LiTV said: member.error.accessdeniederror" while using the cookies (using Get cookies.txt LOCALLY plugin) or username + password
Compared the header from the Debug log with the header on the LiTV site, seems all match, not sure where is the blocking point.
My account able to login and watch the member only video on LiTV site


### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] 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: ['--print-traffic', '-vUcw', '--embed-thumbnail', '--embed-chapters', '--no-playlist', '--cookies', 'ck.txt', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36', '--add-headers', 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8', 'https://www.litv.tv/vod/comic/content.do?content_id=VOD00299822']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.11.16 from yt-dlp/yt-dlp [24f827875] (win_x86_exe)
[debug] Python 3.7.9 (CPython AMD64 32bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1g  21 Apr 2020)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.19.0, brotli-1.1.0, certifi-2023.07.22, mutagen-1.47.0, requests-2.31.0, sqlite3-3.31.1, urllib3-2.0.7, websockets-11.0.3
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests
[debug] Loaded 1901 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
director: Handler preferences for this request: urllib=0, requests=100
director: Checking if "requests" supports this request.
director: Sending request via "requests"
requests: Starting new HTTPS connection (1): api.github.com:443
send: b'GET /repos/yt-dlp/yt-dlp/releases/latest HTTP/1.1\r\nHost: api.github.com\r\nConnection: keep-alive\r\nUser-Agent: yt-dlp\r\nAccept: application/vnd.github+json\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nX-Github-Api-Version: 2022-11-28\r\nAccept-Encoding: gzip, deflate, br\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server: GitHub.com
header: Date: Fri, 24 Nov 2023 05:27:48 GMT
header: Content-Type: application/json; charset=utf-8
header: Cache-Control: public, max-age=60, s-maxage=60
header: Vary: Accept, Accept-Encoding, Accept, X-Requested-With
header: ETag: W/"d1db9deb227844c4f769d3c71a7cc149a95067a4c141f6f3788c416ff88c3135"
header: Last-Modified: Thu, 16 Nov 2023 00:17:27 GMT
header: X-GitHub-Media-Type: github.v3; format=json
header: x-github-api-version-selected: 2022-11-28
header: Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
header: Access-Control-Allow-Origin: *
header: Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
header: X-Frame-Options: deny
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 0
header: Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
header: Content-Security-Policy: default-src 'none'
header: Content-Encoding: gzip
header: X-RateLimit-Limit: 60
header: X-RateLimit-Remaining: 53
header: X-RateLimit-Reset: 1700804241
header: X-RateLimit-Resource: core
header: X-RateLimit-Used: 7
header: Accept-Ranges: bytes
header: Content-Length: 3365
header: X-GitHub-Request-Id: 3D56:1C5BD1:38E08C:3CA3D2:6560345D
Latest version: stable@2023.11.16 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2023.11.16 from yt-dlp/yt-dlp)
[LiTV] Extracting URL: https://www.litv.tv/vod/comic/content.do?content_id=VOD00299822
[LiTV] VOD00299822: Downloading webpage
director: Handler preferences for this request: urllib=0, requests=100
director: Checking if "requests" supports this request.
director: Sending request via "requests"
requests: Starting new HTTPS connection (1): www.litv.tv:443
send: b'GET /vod/comic/content.do?content_id=VOD00299822 HTTP/1.1\r\nHost: www.litv.tv\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nAccept-Encoding: gzip, deflate, br\r\nCookie: PUID=puid; JSESSIONID=990FCC764170A525E46BAFB7BB2CF3FF.jvm1; SESSION=d03a422c-d864-4e98-bec2-67fe35f516cf; SPRING_SECURITY_REMEMBER_ME_COOKIE=cookies\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: server: Apache-Coyote/1.1
header: set-cookie: JSESSIONID=BC49EA311190C6C9DFB212CEFE7BADDF.jvm1; Path=/; HttpOnly
header: content-type: text/html;charset=UTF-8
header: content-language: en-US
header: content-encoding: gzip
header: vary: Accept-Encoding
header: date: Fri, 24 Nov 2023 05:27:58 GMT
header: via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Transfer-Encoding: chunked
[LiTV] Downloading just the video VOD00299822 because of --no-playlist
[LiTV] VOD00299822: Downloading JSON metadata
director: Handler preferences for this request: urllib=0, requests=100
director: Checking if "requests" supports this request.
director: Sending request via "requests"
send: b'POST /vod/ajax/getMainUrlNoAuth HTTP/1.1\r\nHost: www.litv.tv\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/json\r\nAccept-Encoding: gzip, deflate, br\r\nCookie: PUID=puid; JSESSIONID=BC49EA311190C6C9DFB212CEFE7BADDF.jvm1; SESSION=d03a422c-d864-4e98-bec2-67fe35f516cf; SPRING_SECURITY_REMEMBER_ME_COOKIE=cookie\r\nContent-Length: 118\r\n\r\n'
send: b'{"assetId": "vod11442-110002M001_800K", "watchDevices": ["CABLE", "PC", "PHONE", "PAD", "TV"], "contentType": "comic"}'
reply: 'HTTP/1.1 200 OK\r\n'
header: server: Apache-Coyote/1.1
header: set-cookie: JSESSIONID=B91F10C7CC0B1721A7D421EF065AD503.jvm1; Path=/; HttpOnly
header: content-type: application/json;charset=UTF-8
header: content-encoding: gzip
header: vary: Accept-Encoding
header: date: Fri, 24 Nov 2023 05:27:58 GMT
header: via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Transfer-Encoding: chunked
ERROR: [LiTV] VOD00299822: LiTV said: member.error.accessdeniederror
  File "yt_dlp\extractor\common.py", line 715, in extract
  File "yt_dlp\extractor\litv.py", line 114, in _real_extract
```



Discussion:
seems like the url change from https://www.litv.tv/vod/ajax/getMainUrlNoAuth to https://www.litv.tv/vod/ajax/getUrl
Next, the payload seems changed too, let me try to dig futher...
payload change from
            payload = {
                'assetId': program_info['assetId'],
                'watchDevices': program_info['watchDevices'],
                'contentType': program_info['contentType'],
            }
to
            payload = {
                'type': 'auth',
                'assetId': program_info['assetId'],
                'puid': cookiesPUID
            }
Can you try this patch?
```diff
diff --git a/yt_dlp/extractor/litv.py b/yt_dlp/extractor/litv.py
index 2c7c7175e..1003fb2fd 100644
--- a/yt_dlp/extractor/litv.py
+++ b/yt_dlp/extractor/litv.py
@@ -6,6 +6,7 @@
     int_or_none,
     smuggle_url,
     traverse_obj,
+    try_call,
     unsmuggle_url,
 )
 
@@ -96,13 +97,22 @@ def _real_extract(self, url):
             r'uiHlsUrl\s*=\s*testBackendData\(([^;]+)\);',
             webpage, 'video data', default='{}'), video_id)
         if not video_data:
-            payload = {
-                'assetId': program_info['assetId'],
-                'watchDevices': program_info['watchDevices'],
-                'contentType': program_info['contentType'],
-            }
+            payload = {'assetId': program_info['assetId']}
+            puid = try_call(lambda: self._get_cookies('https://www.litv.tv/')['PUID'].value)
+            if puid:
+                payload.update({
+                    'type': 'auth',
+                    'puid': puid,
+                })
+                endpoint = 'getUrl'
+            else:
+                payload.update({
+                    'watchDevices': program_info['watchDevices'],
+                    'contentType': program_info['contentType'],
+                })
+                endpoint = 'getMainUrlNoAuth'
             video_data = self._download_json(
-                'https://www.litv.tv/vod/ajax/getMainUrlNoAuth', video_id,
+                f'https://www.litv.tv/vod/ajax/{endpoint}', video_id,
                 data=json.dumps(payload).encode('utf-8'),
                 headers={'Content-Type': 'application/json'})
 
```
Hi @bashonly,

Thanks a lot for the fix, now it works.

./yt-dlp.sh --print-traffic -vUcw --embed-thumbnail --embed-chapters --cookies ck.txt  --no-playlist --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" --add-headers "Content-Type:application/x-www-form-urlencoded; charset=UTF-8"  https://www.litv.tv/vod/comic/content.do?content_id=VOD00299822
[debug] Command-line config: ['--print-traffic', '-vUcw', '--embed-thumbnail', '--embed-chapters', '--cookies', 'ck.txt', '--no-playlist', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36', '--add-headers', 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8', 'https://www.litv.tv/vod/comic/content.do?content_id=VOD00299822']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.11.16 from yt-dlp/yt-dlp [24f827875]
[debug] Lazy loading extractors is disabled
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-6.2.0-37-generic-x86_64-with-glibc2.35 (OpenSSL 3.0.2 15 Mar 2022, glibc 2.35)
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2
[debug] Optional libraries: certifi-2020.06.20, pycrypto-3.19.0, requests-2.25.1, secretstorage-3.3.1, sqlite3-3.37.2, urllib3-1.26.5
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Loaded 1915 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
director: Handler preferences for this request: urllib=0
director: Checking if "urllib" supports this request.
director: Sending request via "urllib"
send: b'GET /repos/yt-dlp/yt-dlp/releases/latest HTTP/1.1\r\nHost: api.github.com\r\nUser-Agent: yt-dlp\r\nAccept: application/vnd.github+json\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nX-Github-Api-Version: 2022-11-28\r\nAccept-Encoding: gzip, deflate\r\nConnection: close\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server: GitHub.com
header: Date: Fri, 24 Nov 2023 23:42:06 GMT
header: Content-Type: application/json; charset=utf-8
header: Cache-Control: public, max-age=60, s-maxage=60
header: Vary: Accept, Accept-Encoding, Accept, X-Requested-With
header: ETag: W/"aaed9bd4655ee59d2cc567d87c26aa8f63e9d8ca8269af9abd67680cecb5d144"
header: Last-Modified: Thu, 16 Nov 2023 00:17:27 GMT
header: X-GitHub-Media-Type: github.v3; format=json
header: x-github-api-version-selected: 2022-11-28
header: Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
header: Access-Control-Allow-Origin: *
header: Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
header: X-Frame-Options: deny
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 0
header: Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
header: Content-Security-Policy: default-src 'none'
header: Content-Encoding: gzip
header: X-RateLimit-Limit: 60
header: X-RateLimit-Remaining: 57
header: X-RateLimit-Reset: 1700872495
header: X-RateLimit-Resource: core
header: X-RateLimit-Used: 3
header: Accept-Ranges: bytes
header: Content-Length: 3368
header: X-GitHub-Request-Id: 3C4A:1ADBE1:994E86:A307DF:656134CF
header: connection: close
Latest version: stable@2023.11.16 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2023.11.16 from yt-dlp/yt-dlp)
[LiTV] Extracting URL: https://www.litv.tv/vod/comic/content.do?content_id=VOD00299822
[LiTV] VOD00299822: Downloading webpage
director: Handler preferences for this request: urllib=0
director: Checking if "urllib" supports this request.
director: Sending request via "urllib"
send: b'GET /vod/comic/content.do?content_id=VOD00299822 HTTP/1.1\r\nHost: www.litv.tv\r\nCookie: PUID=puid; JSESSIONID=140ECE1B8C72EE5807E6809C7695E7D5.jvm1; SESSION=acb86962-be74-4fea-941c-c9a2bafbddfd; SPRING_SECURITY_REMEMBER_ME_COOKIE=cookies\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nAccept-Encoding: gzip, deflate\r\nConnection: close\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: server: Apache-Coyote/1.1
header: set-cookie: JSESSIONID=520B9C85F235318677093CF5A651796A.jvm1; Path=/; HttpOnly
header: content-type: text/html;charset=UTF-8
header: content-language: en-US
header: content-encoding: gzip
header: vary: Accept-Encoding
header: date: Fri, 24 Nov 2023 23:42:08 GMT
header: via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Connection: close
header: Transfer-Encoding: chunked
[LiTV] Downloading just the video VOD00299822 because of --no-playlist
[LiTV] VOD00299822: Downloading JSON metadata
director: Handler preferences for this request: urllib=0
director: Checking if "urllib" supports this request.
director: Sending request via "urllib"
send: b'POST /vod/ajax/getUrl HTTP/1.1\r\nContent-Length: 103\r\nHost: www.litv.tv\r\nCookie: PUID=puid; JSESSIONID=520B9C85F235318677093CF5A651796A.jvm1; SESSION=acb86962-be74-4fea-941c-c9a2bafbddfd; SPRING_SECURITY_REMEMBER_ME_COOKIE=cookiesl\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/json\r\nAccept-Encoding: gzip, deflate\r\nConnection: close\r\n\r\n'
send: b'{"assetId": "vod11442-110002M001_800K", "type": "auth", "puid": "cd230eb9-7bf1-412c-84e9-1de989387e45"}'
reply: 'HTTP/1.1 200 OK\r\n'
header: server: Apache-Coyote/1.1
header: set-cookie: JSESSIONID=CB50F030C4AD68D63D67EDC0B8BC772F.jvm1; Path=/; HttpOnly
header: set-cookie: SESSION=e6fa82b1-2cca-4723-9899-c54b82863c6a; Path=/; HttpOnly
header: content-type: application/json;charset=UTF-8
header: content-encoding: gzip
header: vary: Accept-Encoding
header: date: Fri, 24 Nov 2023 23:42:09 GMT
header: via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Connection: close
header: Transfer-Encoding: chunked
[LiTV] VOD00299822: Downloading m3u8 information
director: Handler preferences for this request: urllib=0
director: Checking if "urllib" supports this request.
director: Sending request via "urllib"
send: b'GET /hi/vod/e9IIpROkQzw/master.m3u8 HTTP/1.1\r\nHost: p-hebe.svc.litv.tv\r\nCookie: PUID=cd230eb9-7bf1-412c-84e9-1de989387e45\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nAccept-Encoding: gzip, deflate\r\nConnection: close\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Accept-Ranges: bytes
header: Access-Control-Allow-Origin: *
header: Cache-Control: private, no-cache, no-store, must-revalidate
header: Content-Length: 716
header: Content-Type: application/vnd.apple.mpegurl
header: Expires: 0
header: Last-Modified: Fri, 24 Nov 2023 23:42:09 GMT
header: Vary: Accept-Encoding
header: Date: Fri, 24 Nov 2023 23:42:09 GMT
header: Via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Connection: close
[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] VOD00299822: Downloading 1 format(s): hls-6404
[info] Video thumbnail is already present
[debug] Invoking hlsnative downloader on "https://p-hebe.svc.litv.tv/hi/vod/e9IIpROkQzw/litv-animation-vod11442-110002M001-video_eng=5911761-audio_chi=129899.m3u8"
[hlsnative] Downloading m3u8 manifest
director: Handler preferences for this request: urllib=0
director: Checking if "urllib" supports this request.
director: Sending request via "urllib"
send: b'GET /hi/vod/e9IIpROkQzw/litv-animation-vod11442-110002M001-video_eng=5911761-audio_chi=129899.m3u8 HTTP/1.1\r\nHost: p-hebe.svc.litv.tv\r\nCookie: PUID=cd230eb9-7bf1-412c-84e9-1de989387e45\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nAccept-Encoding: identity\r\nConnection: close\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Accept-Ranges: bytes
header: Access-Control-Allow-Origin: *
header: Cache-Control: private, no-cache, no-store, must-revalidate
header: Content-Length: 27334
header: Content-Type: application/vnd.apple.mpegurl
header: Expires: 0
header: Last-Modified: Fri, 24 Nov 2023 23:42:09 GMT
header: Vary: Accept-Encoding
header: Date: Fri, 24 Nov 2023 23:42:09 GMT
header: Via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Connection: close
[hlsnative] Total fragments: 141
[download] Destination: 新蠟筆小新 第十一季(中文版)第2集 [VOD00299822].mp4
director: Handler preferences for this request: urllib=0
director: Checking if "urllib" supports this request.
director: Sending request via "urllib"
send: b'GET /vod/content01/litv-animation-vod11442-110002M001/litv-hls-cl-pc/litv-animation-vod11442-110002M001-audio_chi=129899-video_eng=5911761-3.ts HTTP/1.1\r\nHost: litvpc.akamaized.net\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nAccept-Encoding: identity\r\nRange: bytes=2096128-\r\nConnection: close\r\n\r\n'
reply: 'HTTP/1.1 206 Partial Content\r\n'
header: Server: HiNetCDN/2307
header: Last-Modified: Sat, 30 Sep 2023 07:54:10 GMT
header: ETag: "633a03f6f-1454-6068ed8a75a06;7920440"
header: X-Anevia-Edge: MISS
header: Accept-Ranges: bytes
header: X-Amz-Cf-Pop: TPE51-C1
header: X-Amz-Cf-Id: Ki7VdYv4mcs9FuU5FXBla-3AVpMxc3BimpLCAdD3VBBurXVycEL96w==
header: Cache-Control: max-age=26785983
header: Expires: Mon, 30 Sep 2024 00:15:13 GMT
header: Date: Fri, 24 Nov 2023 23:42:10 GMT
header: Content-Range: bytes 2096128-7920439/7920440
header: Content-Length: 5824312
header: Connection: close
header: Akamai-Mon-Iucid-Del: 763067
header: Content-Type: video/MP2T
header: Access-Control-Max-Age: 86400
header: Access-Control-Allow-Credentials: true
header: Access-Control-Expose-Headers: Server,range,hdntl,hdnts,Akamai-Mon-Iucid-Ing,Akamai-Mon-Iucid-Del,Akamai-Request-BC
header: Access-Control-Allow-Headers: origin,range,hdntl,hdnts,CMCD-Request,CMCD-Object,CMCD-Status,CMCD-Session
header: Access-Control-Allow-Methods: GET,POST,OPTIONS
header: Access-Control-Allow-Origin: *
[download]   1.6% of ~   1.37GiB at    3.31MiB/s ETA 05:53 (frag 3/141)director: Handler preferences for this request: urllib=0
director: Checking if "urllib" supports this request.
director: Sending request via "urllib"
@PureUsername thanks for testing the patch. Could you also test if publicly available content is still downloadable when passing cookies? (with the patch applied)
@bashonly sorry for the late update and yes, it's able to download

Resolving patch:
diff --git a/yt_dlp/extractor/litv.py b/yt_dlp/extractor/litv.py
--- a/yt_dlp/extractor/litv.py
+++ b/yt_dlp/extractor/litv.py
@@ -6,6 +6,7 @@
     int_or_none,
     smuggle_url,
     traverse_obj,
+    try_call,
     unsmuggle_url,
 )
 
@@ -96,13 +97,22 @@ def _real_extract(self, url):
             r'uiHlsUrl\s*=\s*testBackendData\(([^;]+)\);',
             webpage, 'video data', default='{}'), video_id)
         if not video_data:
-            payload = {
-                'assetId': program_info['assetId'],
-                'watchDevices': program_info['watchDevices'],
-                'contentType': program_info['contentType'],
-            }
+            payload = {'assetId': program_info['assetId']}
+            puid = try_call(lambda: self._get_cookies('https://www.litv.tv/')['PUID'].value)
+            if puid:
+                payload.update({
+                    'type': 'auth',
+                    'puid': puid,
+                })
+                endpoint = 'getUrl'
+            else:
+                payload.update({
+                    'watchDevices': program_info['watchDevices'],
+                    'contentType': program_info['contentType'],
+                })
+                endpoint = 'getMainUrlNoAuth'
             video_data = self._download_json(
-                'https://www.litv.tv/vod/ajax/getMainUrlNoAuth', video_id,
+                f'https://www.litv.tv/vod/ajax/{endpoint}', video_id,
                 data=json.dumps(payload).encode('utf-8'),
                 headers={'Content-Type': 'application/json'})
 


Test patch: