Skip to content

Commit 3b7d67d

Browse files
committed
feat: add support for auto-dubbed audio format detection
1 parent 6b64751 commit 3b7d67d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Sources/YouTubeKit/YouTubeResponseTypes/VideoInfos/AudioOnlyFormat.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ public struct AudioOnlyFormat: DownloadFormat {
5454

5555
/// Struct representing some informations about the audio track language.
5656
public struct FormatLocaleInfos: Sendable {
57-
public init(displayName: String? = nil, localeId: String? = nil, isDefaultAudioFormat: Bool? = nil) {
57+
public init(displayName: String? = nil, localeId: String? = nil, isDefaultAudioFormat: Bool? = nil, isAutoDubbed: Bool? = nil) {
5858
self.displayName = displayName
5959
self.localeId = localeId
6060
self.isDefaultAudioFormat = isDefaultAudioFormat
61+
self.isAutoDubbed = isAutoDubbed
6162
}
6263

6364
/// Name of the language, e.g. "French".
@@ -68,7 +69,10 @@ public struct AudioOnlyFormat: DownloadFormat {
6869
/// Id of the language, generally is the language code that has ".n" has suffix. E.g. "fr.3" or "en.4".
6970
public var localeId: String?
7071

71-
/// Boolean indicating whether the format is considered as the default one by YouTube (depends on the ``YouTubeModel``'s locale and the cookie's (if provided) account's default language).
72+
/// A boolean indicating whether the audio was auto-dubbed by YouTube.
73+
public var isAutoDubbed: Bool?
74+
75+
/// A boolean indicating whether the format is considered as the default one by YouTube (depends on the ``YouTubeModel``'s locale and the cookie's (if provided) account's default language).
7276
public var isDefaultAudioFormat: Bool?
7377
}
7478
}

Sources/YouTubeKit/YouTubeResponseTypes/VideoInfos/VideoInfosWithDownloadFormatsResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ public struct VideoInfosWithDownloadFormatsResponse: YouTubeResponse {
473473
}
474474
}(),
475475
loudness: json["loudnessDb"].double,
476-
formatLocaleInfos: json["audioTrack", "id"].string != nil ? .init(displayName: json["audioTrack", "displayName"].string, localeId: json["audioTrack", "id"].string, isDefaultAudioFormat: json["audioTrack", "audioIsDefault"].bool) : nil
476+
formatLocaleInfos: json["audioTrack", "id"].string != nil ? .init(displayName: json["audioTrack", "displayName"].string, localeId: json["audioTrack", "id"].string, isDefaultAudioFormat: json["audioTrack", "audioIsDefault"].bool, isAutoDubbed: json["audioTrack", "isAutoDubbed"].bool) : nil
477477
)
478478
}
479479
}

0 commit comments

Comments
 (0)