Summary
Keep each InnerTube.VideoInfo paired with its originating InnerTube.StreamingData during local stream extraction.
Rationale
In Sources/YouTubeKit/YouTube.swift, streamingData removes VideoInfo responses that do not contain StreamingData. The streams implementation then uses zip(allStreamingData, videoInfos). If an earlier response has no streaming data, this can pair a later stream manifest with the wrong VideoInfo.
Extraction.applySignature(streamManifest:videoInfo:js:) does not currently use the supplied VideoInfo, so this does not cause a known behavior change. The code should be corrected before stream processing depends on VideoInfo metadata.
Affected area
Sources/YouTubeKit/YouTube.swift
YouTube.streamingData
- Local extraction in
YouTube.streams
Required changes
Use a representation that preserves the VideoInfo and StreamingData relationship. For example, iterate over videoInfos and skip responses without streamingData, or return and consume paired values.
Acceptance criteria
- Each processed
StreamingData uses its source VideoInfo.
- Responses without
streamingData do not change the pairing of later responses.
- The change does not alter the intended fallback behavior.
Backlinks
Summary
Keep each
InnerTube.VideoInfopaired with its originatingInnerTube.StreamingDataduring local stream extraction.Rationale
In
Sources/YouTubeKit/YouTube.swift,streamingDataremovesVideoInforesponses that do not containStreamingData. Thestreamsimplementation then useszip(allStreamingData, videoInfos). If an earlier response has no streaming data, this can pair a later stream manifest with the wrongVideoInfo.Extraction.applySignature(streamManifest:videoInfo:js:)does not currently use the suppliedVideoInfo, so this does not cause a known behavior change. The code should be corrected before stream processing depends onVideoInfometadata.Affected area
Sources/YouTubeKit/YouTube.swiftYouTube.streamingDataYouTube.streamsRequired changes
Use a representation that preserves the
VideoInfoandStreamingDatarelationship. For example, iterate overvideoInfosand skip responses withoutstreamingData, or return and consume paired values.Acceptance criteria
StreamingDatauses its sourceVideoInfo.streamingDatado not change the pairing of later responses.Backlinks