Repository: yt-dlp/yt-dlp

Issue:
Incomplete videos from Curiosity Stream
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.04.08** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#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 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

_No response_

### Description

Video: https://curiositystream.com/video/3195

Command: `yt-dlp --no-playlist --no-check-certificate --force-ipv4 --no-call-home --sponskrub --cookies-from-browser vivaldi https://curiositystream.com/video/3195 -vU`

Downloaded video has only 2 minutes instead of 19:   
```
> mediainfo The\ Science\ of\ Cute\ \[3195\].mp4 | grep Duration
Duration                                 : 2 min 0 s
Duration                                 : 1 min 59 s
mdhd_Duration                            : 119991
Duration                                 : 2 min 0 s
```
<img width="855" alt="2022-05-16_06-55" src="https://user-images.githubusercontent.com/1975567/168522368-130cd245-1561-4a2f-a71b-4298dfb0275d.png">

Not sure if relevant, but the account info from browser is working for Nebula (I can download premium videos from there). I am logged in to Curiosity Stream in Vivaldi.

### Verbose log

```shell
[debug] Command-line config: ['--no-playlist', '--no-check-certificate', '--force-ipv4', '--no-call-home', '--sponskrub', '--cookies-from-browser', 'vivaldi', 'https://curiositystream.com/video/3195', '-vU']
DeprecationWarning: --sponskrub is deprecated and may be removed in a future version. Use --sponsorblock-mark or --sponsorblock-remove instead
[Cookies] Extracting cookies from vivaldi
[debug] Extracting cookies from: "/home/xxx/.config/vivaldi/Default/Cookies"
[debug] detected desktop environment: OTHER
[debug] Chosen keyring: BASICTEXT
[Cookies] Extracted 3286 cookies from vivaldi
[debug] cookie version breakdown: {'v10': 3239, 'v11': 0, 'other': 0, 'unencrypted': 47}
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, err utf-8, pref UTF-8
[debug] yt-dlp version 2022.04.08 [7884ade65]
[debug] Python version 3.10.4 (CPython 64bit) - Linux-5.16.20-2-MANJARO-x86_64-with-glibc2.35
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 5.0 (setts), ffprobe 5.0, rtmpdump 2.4
[debug] Optional libraries: brotlicffi, certifi, Cryptodome, secretstorage, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2022.04.08, Current version: 2022.04.08
yt-dlp is up to date (2022.04.08)
[debug] [curiositystream] Extracting URL: https://curiositystream.com/video/3195
[curiositystream] 3195: Downloading JSON metadata
[curiositystream] 3195: Downloading m3u8 information
WARNING: [curiositystream] Ignoring subtitle tracks found in the HLS manifest; if any subtitle tracks are missing, please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
[curiositystream] 3195: Downloading JSON metadata
[curiositystream] 3195: Downloading MPD manifest
WARNING: [curiositystream] Ignoring subtitle tracks found in the DASH manifest; if any subtitle tracks are missing, please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 3195: Downloading 1 format(s): hls-12242+dash-ec2d1141-740c-46f3-ad41-52ae88c2e3fa
[debug] Invoking downloader on "https://cdn-s3-akm.curiositystream.com/bitmovin-outputs/cop_brightnow_thescienceofcute_rev1_eng_f2398_uhd_s443_3195.mp4/vod-fix-2160_12025728_0e1c004f-e3b1-4d0b-a155-2411e30024fe_base.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 30
[download] Destination: The Science of Cute [3195].fhls-12242.mp4
[download] 100% of 172.81MiB in 00:09
[debug] Invoking downloader on "https://cdn-s3-akm.curiositystream.com/bitmovin-outputs/cop_brightnow_thescienceofcute_rev1_eng_f2398_uhd_s443_3195.mp4/5469804ba16184e9d7aca4bc01321002.mpd"
[dashsegments] Total fragments: 31
[download] Destination: The Science of Cute [3195].fdash-ec2d1141-740c-46f3-ad41-52ae88c2e3fa.m4a
[download] 100% of 2.28MiB in 00:06
[Merger] Merging formats into "The Science of Cute [3195].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:The Science of Cute [3195].fhls-12242.mp4' -i 'file:The Science of Cute [3195].fdash-ec2d1141-740c-46f3-ad41-52ae88c2e3fa.m4a' -c copy -map 0:v:0 -map 1:a:0 -movflags +faststart 'file:The Science of Cute [3195].temp.mp4'
Deleting original file The Science of Cute [3195].fhls-12242.mp4 (pass -k to keep)
Deleting original file The Science of Cute [3195].fdash-ec2d1141-740c-46f3-ad41-52ae88c2e3fa.m4a (pass -k to keep)
[SponSkrub] Skipping sponskrub since it is not a YouTube video
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/curiositystream.py b/yt_dlp/extractor/curiositystream.py
--- a/yt_dlp/extractor/curiositystream.py
+++ b/yt_dlp/extractor/curiositystream.py
@@ -23,6 +23,11 @@ def _handle_errors(self, result):
 
     def _call_api(self, path, video_id, query=None):
         headers = {}
+        if not self._auth_token:
+            auth_cookie = self._get_cookies('https://curiositystream.com').get('auth_token')
+            if auth_cookie:
+                self.write_debug('Obtained auth_token cookie')
+                self._auth_token = cookie.value
         if self._auth_token:
             headers['X-Auth-Token'] = self._auth_token
         result = self._download_json(


Test patch: