Repository: yt-dlp
Issue: [Broken] [Twitch] Reruns wrongly use built-in HLS downloader
Labels: site-bug

<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of yt-dlp:
- First of, make sure you are using the latest version of yt-dlp. Run `yt-dlp --version` and ensure your version is 2021.09.25. If it's not, see https://github.com/yt-dlp/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in https://github.com/yt-dlp/yt-dlp.
- Search the bugtracker for similar issues: https://github.com/yt-dlp/yt-dlp. DO NOT post duplicates.
- Finally, put x into all relevant boxes like this [x] (Dont forget to delete the empty space)
-->

- [x] I'm reporting a broken site support
- [x] I've verified that I'm running yt-dlp version **2021.09.25**
- [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
- [x] I've searched the bugtracker for similar issues including closed ones


## Verbose log

<!--
Provide the complete verbose output of yt-dlp that clearly demonstrates the problem.
Add the `-v` flag to your command line you run yt-dlp with (`yt-dlp -v <your command line>`), copy the WHOLE output and insert it below. It should look similar to this:
 [debug] System config: []
 [debug] User config: []
 [debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKc']
 [debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
 [debug] yt-dlp version 2021.09.25
 [debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
 [debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
 [debug] Proxy map: {}
 <more lines>
-->

```
[debug] Command-line config: ['-v', '--ignore-config', '--', 'https://twitch.tv/thenicolet']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] yt-dlp version 2021.09.25
[debug] Python version 3.9.7 (CPython 64bit) - Linux-5.14.8-arch1-1-x86_64-with-glibc2.33
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4, rtmpdump 2.4
[debug] Optional libraries: Crypto, mutagen, sqlite, websockets
[debug] Proxy map: {}
[debug] [twitch:stream] Extracting URL: https://twitch.tv/thenicolet
[twitch:stream] thenicolet: Downloading stream GraphQL
[twitch:stream] thenicolet: Downloading stream access token GraphQL
[twitch:stream] 43958430141: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, 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] 43958430141: Downloading 1 format(s): 720p60__source_
[debug] Invoking downloader on "https://video-weaver.yto01.hls.ttvnw.net/v1/playlist/CqEEmIRzMNdlAvxILqXFpzHMJ3WkCz41_Wf6jTkKo5c8b4Q7Se0aUpjkiuB_F2o-PCJYvRCEJ1UiOpldCZSwS6G-SdcPqsHGZLFd4oh0Hp8bT8UMH21xS4fLRxH96AVFo5fQkt8gmk_DdjcCtSwIkPdxeCaWQ8ppNcmvJ0z7ruqSYOjofEgzLY_EelNULujW2JTyAl_hTfsN3imfDi9aPXDpa4p1Ci7q2Ryz75QlCXHZ5p-w4-AQN-yfMYRRwqhjoW7m29-FQrulwHykjyV3xQD8CKHgTOMvLKl3lkw6zoRra7C8pgejmlBqwn3hwJhSTCzgBMVpon4iDboQBB3x2XdKPonMW9Rzf4_MS6QSgeiWRrtkMHGPK2mGQygaER0m_KrKs96q2Bx6AE1Shbg4pnRgHg6OdBmo9Zs85SIXmyEgWTFaSR4775b6uvKMxF55EzC9Lpz9zb1UepN2LtLgJLp1XLwzRZmtdf_C9WxYPWQQpEWvRyJTf14JQ8JQCerEMikp35RJbPAr7iBj7zALeipK6VEpjFMJK29yfl51_1ILaB2nqZYk6IA1tUOtVr2hxBpNU9MxKzeaPpr_U7W5We2QQNmQyeYCLpQBt9yHjdMK1kYRm9oJVtK4d-NE0TXK0Udxe1C3uJEyYKwQqOpugAKs9QWtXRMyBjsQ83DOAuyRtL8tWSMqoUtdYNNy_eFlpMgcOGOtHJaYJlF3o57amXeUq5ESEKFcreV1IRztan5vKH95BQAaDM5TZqb9PIK2D-5ukg.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 3
[download] Destination: TheNicoleT (rerun) 2021-10-05 11_18 [43958430141].mp4
[download] 100% of 3.49MiB in 00:01
[debug] ffmpeg command line: ffprobe -show_streams 'file:TheNicoleT (rerun) 2021-10-05 11_18 [43958430141].mp4'
[FixupM3u8] Fixing malformed AAC bitstream of "TheNicoleT (rerun) 2021-10-05 11_18 [43958430141].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:TheNicoleT (rerun) 2021-10-05 11_18 [43958430141].mp4' -c copy -map 0 -dn -f mp4 -bsf:a aac_adtstoasc 'file:TheNicoleT (rerun) 2021-10-05 11_18 [43958430141].temp.mp4'
```
<!--
Do not remove the above ```
-->


## Description

<!--
Provide an explanation of your issue in an arbitrary form. Provide any additional information, suggested solution and as much context and examples as possible.
If work on your issue requires account credentials please provide them or explain how one can obtain them.
-->

Twitch supports several types of media, including livestreams and VODs. Some livestreams are labelled as "reruns" - they are prerecorded like VODs, but are in most respects served like livestreams, and are handled by the `twitch:stream` extractor. The extractor can tell the difference between live streams and reruns; the `is_live` flag is set to false for reruns.

When `yt-dlp` is downloading a Twitch livestream, it uses `ffmpeg` to download the stream because the built-in HLS downloader is unable to re-fetch the m3u8 file repeatedly to download livestreams. However, for reruns, `yt-dlp` incorrectly uses the built-in downloader, and thus only downloads a tiny segment of the livestream. This is a regression relative to `youtube-dl`, which works correctly for reruns.

This has been noted before in #1089 as an aside, but I don't see a ticket actually tracking the issue.

The download link I've provided above is a channel that frequently runs reruns (and is running one as I write this). You may be able to find others at https://www.twitch.tv/search?term=rerun&type=channels if needed.