Skip to content

Releases: alexeichhorn/YouTubeKit

0.2.4

31 Oct 11:12
Compare
Choose a tag to compare
  • more available streams in extraction results
  • Swift 6 support: most structs are now Sendable

0.2.3

02 Jul 20:34
Compare
Choose a tag to compare

Fixed an issue where some video streams returned a 403 error when trying to download

0.2.2

14 Apr 12:45
Compare
Choose a tag to compare

fixed an issue where some videos were not playable

0.2.1

17 Mar 11:27
723d13c
Compare
Choose a tag to compare

Fixes for rare stream extraction issues

0.2

27 Dec 12:43
f67f4c3
Compare
Choose a tag to compare
0.2

The biggest update so far:

Native Playable Streams

Playing a YouTube video stream or audio stream in AVPlayer always comes with the challenge of filtering the stream urls that are actually natively supported by the current operating system. This has now become a built-in feature in YouTubeKit:
Every Stream now has an isNativelyPlayable property. It is true if the codecs of the stream are supported by the current OS & device running the code.
If you want to play a video in AVPlayer, you can now simply do:

let stream = try await YouTube(videoID: "QdBZY2fkU-0").streams
                          .filterVideoAndAudio()
                          .filter { $0.isNativelyPlayable }
                          .highestResolutionStream()

let player = AVPlayer(url: stream!.url)
// -> Now, present the player however you like

Metadata (thx @waliid)

Get metadata of a YouTube video directly in YouTubeKit by simply calling:

let metadata = try await video.metadata

This returns a metadata object with video title, description, and thumbnails.

Experimental: Remote Extraction Fallback

With local YouTube extractors, there is the problem that YouTube might suddenly change their unofficial API, which can break your existing shipped app. Now, there is an option to activate a fallback that calls a server running a modified version of youtube-dl, which performs the latest extraction formula via the running device. Read more here.

You can activate it by simply adding a .remote method like this:

let streams = try await YouTube(videoID: "2lAe1cqCOXo", methods: [.local, .remote]).streams

Video & Audio Codecs

Streams now have fully type-safe video & audio codec properties. You can easily filter streams by codec:

// filter by the AV1 codec
streams.filter { $0.videoCodec == .av1 }

// filter by video & audio codec
streams.filter { $0.videoCodec == .av1 && $0.audioCodec == .mp4a }

Additional Changes

  • More robust extraction methods: Fixes cases where there were no streams with both audio & video included.
  • New type-safe fileExtension property in Stream. E.g., filter by webm files: streams.filter { $0.fileExtension == .webm }
  • The properties type and subtype are deprecated. They will be empty when using the new remote extraction method. Use fileExtension, videoCodec, and audioCodec instead.
  • New supported formats, such as HLS streams or surround sound.
  • New filtering functions on [Stream]:
    • streams.filter(byResolution: $0 >= 1080 && $0 <= 2160), to filter by your custom resolution requirements.
    • streams.filterAudioAndAudio(), only returns streams which contain both audio and video track. Equivalent but more readable version of streams.filter { $0.isProgressive }.

Full Changelog: 0.1.9...0.2

0.1.9

15 Aug 16:06
Compare
Choose a tag to compare
0.1.9 Pre-release
Pre-release
  • fixed issue where extracted urls returned a 403 error
  • Support for HLS livestream extraction (thx @waliid):
let hlsManifestUrl = try await YouTube(videoID: "21X5lGlDOfg").livestreams
                          .filter { $0.streamType == .hls }
                          .first

0.1.8

01 May 20:51
Compare
Choose a tag to compare
0.1.8 Pre-release
Pre-release

Fixed extraction of most videos

0.1.7

13 Jan 12:07
Compare
Choose a tag to compare
0.1.7 Pre-release
Pre-release

Fixes crash when extracting some videos

0.1.6

11 Nov 22:25
Compare
Choose a tag to compare
0.1.6 Pre-release
Pre-release

Made YouTubeKitError public with additional user-facing descriptions

0.1.5

10 Jun 10:09
Compare
Choose a tag to compare
0.1.5 Pre-release
Pre-release

Fixed extraction of age restricted videos