diff --git a/.jazzy.yaml b/.jazzy.yaml index 3aefd021d..ca9a2e994 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -4,11 +4,11 @@ source_directory: XCDYouTubeKit framework_root: . umbrella_header: XCDYouTubeKit/XCDYouTubeKit.h module: XCDYouTubeKit -module_version: 2.12.0 +module_version: 2.13.0 author: Cédric Luthi author_url: https://twitter.com/0xced readme: README.md github_url: https://github.com/0xced/XCDYouTubeKit -github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.12.0/XCDYouTubeKit +github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.13.0/XCDYouTubeKit diff --git a/CHANGELOG.md b/CHANGELOG.md index 111c9d1fd..6a0110b7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +#### Version 2.13.0 + +* Deprecated `-[XCDYouTubeVideo thumbnailURL]` use `-[XCDYouTubeVideo thumbnailURLs]` (#477) +* Exclude plist files from Swift Package Manager (#478) +* Annotate `languageIdentifier` argument as `nullable` in `XCDYouTubeVideoOperation` +* Add new `author`, `videoDescription` and `channelIdentifier` properties to `XCDYouTubeVideo` (#471) + #### Version 2.12.0 * Add the ability to specify which `streamURLs` to query via `-[XCDYouTubeClient queryVideo:video:streamURLsToQuery:options:cookies:completionHandler:]` & `XCDYouTubeVideoQueryOperation` class. diff --git a/Package.swift b/Package.swift index 6cd408e14..37f41ed58 100644 --- a/Package.swift +++ b/Package.swift @@ -15,6 +15,11 @@ let package = Package( .target( name: "XCDYouTubeKit", path: ".", + exclude: [ + "XCDYouTubeKit/Info.plist", + "XCDYouTubeKit/Configuration.plist", + "XCDYouTubeKit/AppledocSettings.plist" + ], sources: ["XCDYouTubeKit"], publicHeadersPath: "XCDYouTubeKit" ) diff --git a/README.md b/README.md index e7d2a5f11..306eabc51 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ XCDYouTubeKit is available through [CocoaPods](https://cocoapods.org/), [Carthag CocoaPods: ```ruby -pod "XCDYouTubeKit", "~> 2.12" +pod "XCDYouTubeKit", "~> 2.13" ``` Carthage: ```objc -github "0xced/XCDYouTubeKit" ~> 2.12 +github "0xced/XCDYouTubeKit" ~> 2.13 ``` Swift Package Manager: @@ -48,7 +48,7 @@ Add `XCDYouTubeKit` to the dependencies value of your `Package.swift` ```swift dependencies: [ - .package(url: "https://github.com/0xced/XCDYouTubeKit.git", from: "2.12.0") + .package(url: "https://github.com/0xced/XCDYouTubeKit.git", from: "2.13.0") ] ``` diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj index c78a4909c..b3a923beb 100644 --- a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj +++ b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj @@ -760,7 +760,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 2.12.0; + CURRENT_PROJECT_VERSION = 2.13.0; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -804,7 +804,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 2.12.0; + CURRENT_PROJECT_VERSION = 2.13.0; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; diff --git a/XCDYouTubeKit.podspec b/XCDYouTubeKit.podspec index 848518f09..cd423f4a0 100644 --- a/XCDYouTubeKit.podspec +++ b/XCDYouTubeKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "XCDYouTubeKit" - s.version = "2.12.0" + s.version = "2.13.0" s.summary = "YouTube video player for iOS and OS X." s.homepage = "https://github.com/0xced/XCDYouTubeKit" s.screenshot = "https://raw.github.com/0xced/XCDYouTubeKit/#{s.version}/Screenshots/XCDYouTubeVideoPlayerViewController.png" diff --git a/XCDYouTubeKit.xcodeproj/project.pbxproj b/XCDYouTubeKit.xcodeproj/project.pbxproj index 6725867d9..6680fe825 100644 --- a/XCDYouTubeKit.xcodeproj/project.pbxproj +++ b/XCDYouTubeKit.xcodeproj/project.pbxproj @@ -110,6 +110,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 012718E72457786400123A28 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 017234C023FC223D00196707 /* XCDURLGETOperation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XCDURLGETOperation.h; sourceTree = ""; }; 017234C123FC223D00196707 /* XCDURLGETOperation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XCDURLGETOperation.m; sourceTree = ""; }; 0178E76B23F49BBC001C382E /* XCDYouTubeVideoQueryOperation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XCDYouTubeVideoQueryOperation.h; sourceTree = ""; }; @@ -187,6 +188,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 012718E62457786300123A28 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 012718E72457786400123A28 /* AppKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; C20F57A118817D5400EDBFB0 /* XCDYouTubeKit Tests */ = { isa = PBXGroup; children = ( @@ -212,6 +221,7 @@ C2A3F2D217F4827800AC1C3B /* XCDYouTubeKit */, C20F57A118817D5400EDBFB0 /* XCDYouTubeKit Tests */, C2A3F2CE17F4827800AC1C3B /* Products */, + 012718E62457786300123A28 /* Frameworks */, ); indentWidth = 4; sourceTree = ""; @@ -587,6 +597,8 @@ "OTHER_LDFLAGS[sdk=macosx*]" = ( "-framework", CoreServices, + "-framework", + AppKit, ); WARNING_CFLAGS = ( "$(inherited)", @@ -620,6 +632,8 @@ "OTHER_LDFLAGS[sdk=macosx*]" = ( "-framework", CoreServices, + "-framework", + AppKit, ); WARNING_CFLAGS = ( "$(inherited)", @@ -649,10 +663,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 46; + CURRENT_PROJECT_VERSION = 47; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 2.0.0; - DYLIB_CURRENT_VERSION = 2.12.0; + DYLIB_CURRENT_VERSION = 2.13.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -727,10 +741,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 46; + CURRENT_PROJECT_VERSION = 47; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 2.0.0; - DYLIB_CURRENT_VERSION = 2.12.0; + DYLIB_CURRENT_VERSION = 2.13.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; diff --git a/XCDYouTubeKit/XCDYouTubeVideo.h b/XCDYouTubeKit/XCDYouTubeVideo.h index 8e2586361..17c23fca7 100644 --- a/XCDYouTubeKit/XCDYouTubeVideo.h +++ b/XCDYouTubeKit/XCDYouTubeVideo.h @@ -69,6 +69,18 @@ extern NSString *const XCDYouTubeVideoQualityHTTPLiveStreaming; * The title of the video. */ @property (nonatomic, readonly) NSString *title; +/** + * The name of author that uploaded this video. + */ +@property (nonatomic, readonly) NSString *author; +/** + * The channel identifier of YouTube channel that this video belongs to. + */ +@property (nonatomic, readonly) NSString *channelIdentifier; +/** + * The description of the video. + */ +@property (nonatomic, readonly) NSString *videoDescription; /** * The duration of the video in seconds. */ @@ -77,10 +89,15 @@ extern NSString *const XCDYouTubeVideoQualityHTTPLiveStreaming; * The views count of the video. */ @property (nonatomic, readonly) NSInteger viewCount; +/** + * An array of thumbnail URLs for an images of different sizes. Ordered from smaller to bigger. + */ +@property (nonatomic, readonly, nullable) NSArray *thumbnailURLs; /** * A thumbnail URL for an image of small size, i.e. 120×90. May be nil. */ -@property (nonatomic, readonly, nullable) NSURL *thumbnailURL; +@property (nonatomic, readonly, nullable) NSURL *thumbnailURL + DEPRECATED_MSG_ATTRIBUTE("Use `thumbnailURLs` instead."); /** * A thumbnail URL for an image of small size, i.e. 120×90. May be nil. */ diff --git a/XCDYouTubeKit/XCDYouTubeVideo.m b/XCDYouTubeKit/XCDYouTubeVideo.m index 9bed5bf34..39a5d99f7 100644 --- a/XCDYouTubeKit/XCDYouTubeVideo.m +++ b/XCDYouTubeKit/XCDYouTubeVideo.m @@ -198,20 +198,56 @@ - (instancetype) initWithIdentifier:(NSString *)identifier info:(NSDictionary *) title = @""; _title = title; + NSString *author = info[@"author"] == nil? videoDetails[@"author"] : info[@"author"]; + if (author == nil) + author = @""; + _author = author; + + NSString *channelIdentifier = info[@"ucid"] == nil? videoDetails[@"channelId"] : info[@"ucid"]; + if (channelIdentifier == nil) + channelIdentifier = @""; + _channelIdentifier = channelIdentifier; + + NSString *description = videoDetails[@"shortDescription"]; + if (description == nil) + description = @""; + _videoDescription = description; + _viewCount = info[@"viewCount"] == nil? [(NSString *)videoDetails[@"viewCount"] integerValue] : [(NSString *)info[@"viewCount"] integerValue]; _duration = info[@"length_seconds"] == nil? [(NSString *)videoDetails[@"lengthSeconds"] doubleValue] : [(NSString *)info[@"length_seconds"] doubleValue]; NSString *thumbnail = info[@"thumbnail_url"] ?: info[@"iurl"]; - _thumbnailURL = thumbnail ? [NSURL URLWithString:thumbnail] : nil; + NSURL *thumbnailURL = thumbnail ? [NSURL URLWithString:thumbnail] : nil; + _thumbnailURL = thumbnailURL; if (!_thumbnailURL) { - NSArray *thumnails = XCDThumnailArrayWithString(playerResponse); - if (thumnails.count >= 1) { - NSString *thumbnailURLString = thumnails[0][@"url"]; + NSArray *thumbnails = XCDThumnailArrayWithString(playerResponse); + if (thumbnails.count >= 1) { + // Prepare array of thumbnails URLs. + NSMutableArray *thumbnailURLs = [[NSMutableArray alloc] initWithCapacity:thumbnails.count]; + + // Extract URLs. + for (NSDictionary *thumbnailDict in thumbnails) { + NSString *urlStr = thumbnailDict[@"url"]; + NSURL *url = [NSURL URLWithString:urlStr]; + if (url) { + [thumbnailURLs addObject:url]; + } + } + + // Set array. + _thumbnailURLs = [thumbnailURLs copy]; + + // DEPRECATED + NSString *thumbnailURLString = thumbnails[0][@"url"]; _thumbnailURL = thumbnailURLString ? [NSURL URLWithString:thumbnailURLString] : nil; } } + else + { + _thumbnailURLs = [NSArray arrayWithObject:thumbnailURL]; + } NSMutableDictionary *streamURLs = [NSMutableDictionary new]; @@ -455,7 +491,7 @@ - (NSString *) debugDescription NSDateComponentsFormatter *dateComponentsFormatter = [NSDateComponentsFormatter new]; dateComponentsFormatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated; NSString *duration = [dateComponentsFormatter stringFromTimeInterval:self.duration] ?: [NSString stringWithFormat:@"%@ seconds", @(self.duration)]; - NSString *thumbnailDescription = [NSString stringWithFormat:@"Thumbnail: %@", self.thumbnailURL]; + NSString *thumbnailDescription = [NSString stringWithFormat:@"Thumbnails: %@", self.thumbnailURLs]; NSString *streamsDescription = SortedDictionaryDescription(self.streamURLs); return [NSString stringWithFormat:@"<%@: %p> %@\nDuration: %@\nExpiration date: %@\n%@\nStreams: %@", self.class, self, self.description, duration, self.expirationDate, thumbnailDescription, streamsDescription]; } diff --git a/XCDYouTubeKit/XCDYouTubeVideoOperation.h b/XCDYouTubeKit/XCDYouTubeVideoOperation.h index 27b8c5c6a..efd522a11 100644 --- a/XCDYouTubeKit/XCDYouTubeVideoOperation.h +++ b/XCDYouTubeKit/XCDYouTubeVideoOperation.h @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN * * @return An initialized `XCDYouTubeVideoOperation` object. */ -- (instancetype) initWithVideoIdentifier:(NSString *)videoIdentifier languageIdentifier:(NSString *)languageIdentifier cookies:(nullable NSArray *)cookies; +- (instancetype) initWithVideoIdentifier:(NSString *)videoIdentifier languageIdentifier:(nullable NSString *)languageIdentifier cookies:(nullable NSArray *)cookies; /** * Initializes a video operation with the specified video identifier and language identifier and cookies and additional patterns.