From 06d024da797dd7eb5ce9a300798ab8f23435a645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Tue, 30 Jul 2019 10:04:14 -0400 Subject: [PATCH 1/5] Fix empty or zero value title and duration (fixes #443) --- XCDYouTubeKit/XCDYouTubeVideo+Private.h | 1 + XCDYouTubeKit/XCDYouTubeVideo.m | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/XCDYouTubeKit/XCDYouTubeVideo+Private.h b/XCDYouTubeKit/XCDYouTubeVideo+Private.h index 1c4c5304e..ba1a8953f 100644 --- a/XCDYouTubeKit/XCDYouTubeVideo+Private.h +++ b/XCDYouTubeKit/XCDYouTubeVideo+Private.h @@ -15,6 +15,7 @@ extern NSString *XCDQueryStringWithDictionary(NSDictionary *dictionary); extern NSArray *XCDCaptionArrayWithString(NSString *string); extern NSArray *XCDThumnailArrayWithString(NSString *string); extern NSString *XCDHTTPLiveStreamingStringWithString(NSString *string); +extern NSDictionary *XCDDictionaryWithString(NSString *string); @interface XCDYouTubeVideo () diff --git a/XCDYouTubeKit/XCDYouTubeVideo.m b/XCDYouTubeKit/XCDYouTubeVideo.m index f0ce2c5de..cdd65bf3c 100644 --- a/XCDYouTubeKit/XCDYouTubeVideo.m +++ b/XCDYouTubeKit/XCDYouTubeVideo.m @@ -65,6 +65,15 @@ return captionTracks; } +NSDictionary *XCDDictionaryWithString(NSString *string) +{ + NSError *error = nil; + NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; + if (!data) { return nil; } + + return [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error]; +} + NSDictionary *XCDDictionaryWithQueryString(NSString *string) { NSMutableDictionary *dictionary = [NSMutableDictionary new]; @@ -157,6 +166,7 @@ - (instancetype) initWithIdentifier:(NSString *)identifier info:(NSDictionary *) NSString *playerResponse = info[@"player_response"]; NSString *httpLiveStream = info[@"hlsvp"] ?: XCDHTTPLiveStreamingStringWithString(playerResponse); NSString *adaptiveFormats = info[@"adaptive_fmts"]; + NSDictionary *videoDetails = XCDDictionaryWithString(playerResponse)[@"videoDetails"]; NSMutableDictionary *userInfo = response.URL ? [@{ NSURLErrorKey: (id)response.URL } mutableCopy] : [NSMutableDictionary new]; @@ -165,9 +175,12 @@ - (instancetype) initWithIdentifier:(NSString *)identifier info:(NSDictionary *) NSMutableArray *streamQueries = [[streamMap componentsSeparatedByString:@","] mutableCopy]; [streamQueries addObjectsFromArray:[adaptiveFormats componentsSeparatedByString:@","]]; - NSString *title = info[@"title"] ?: @""; + NSString *title = info[@"title"] == nil? videoDetails[@"title"] : info[@"title"]; + if (title == nil) + title = @""; _title = title; - _duration = [(NSString *)info[@"length_seconds"] doubleValue]; + + _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; From 80a5e34a12dcc282a54d8a11572b5be5faa1e832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Tue, 30 Jul 2019 16:36:49 -0400 Subject: [PATCH 2/5] Update CHANGELOG for version 2.7.8 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d0ae6ea9..f6f818ecb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +#### Version 2.7.8 + +* Adaptation to YouTube API change. (#443) + #### Version 2.7.7 * Add another player script regular expression (#438) From 30366dd6b7943708b0e41ca2f2645f55e6efb996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Tue, 30 Jul 2019 16:36:50 -0400 Subject: [PATCH 3/5] Update version to 2.7.8 --- .jazzy.yaml | 4 ++-- .../XCDYouTubeKit Demo.xcodeproj/project.pbxproj | 4 ++-- XCDYouTubeKit.podspec | 2 +- XCDYouTubeKit.xcodeproj/project.pbxproj | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.jazzy.yaml b/.jazzy.yaml index 020700e17..38383580b 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.7.7 +module_version: 2.7.8 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.7.7/XCDYouTubeKit +github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.7.8/XCDYouTubeKit diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj index 0a08dee65..35b923720 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.7.7; + CURRENT_PROJECT_VERSION = 2.7.8; 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.7.7; + CURRENT_PROJECT_VERSION = 2.7.8; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; diff --git a/XCDYouTubeKit.podspec b/XCDYouTubeKit.podspec index 44bca7882..d92ddce2e 100644 --- a/XCDYouTubeKit.podspec +++ b/XCDYouTubeKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "XCDYouTubeKit" - s.version = "2.7.7" + s.version = "2.7.8" 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 f5090a676..365ae9696 100644 --- a/XCDYouTubeKit.xcodeproj/project.pbxproj +++ b/XCDYouTubeKit.xcodeproj/project.pbxproj @@ -613,10 +613,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 2.0.0; - DYLIB_CURRENT_VERSION = 2.7.7; + DYLIB_CURRENT_VERSION = 2.7.8; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -691,10 +691,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 37; + CURRENT_PROJECT_VERSION = 38; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 2.0.0; - DYLIB_CURRENT_VERSION = 2.7.7; + DYLIB_CURRENT_VERSION = 2.7.8; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; From f7407e3545da3c0750bb123a36726770b6542cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Tue, 30 Jul 2019 16:36:50 -0400 Subject: [PATCH 4/5] Point badges to the master branch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c74502f7e..962759154 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## About -[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) -[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/develop) +[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/master.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) +[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/master.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/master) [![Platform](https://img.shields.io/cocoapods/p/XCDYouTubeKit.svg?style=flat)](http://cocoadocs.org/docsets/XCDYouTubeKit/) [![Pod Version](https://img.shields.io/cocoapods/v/XCDYouTubeKit.svg?style=flat)](https://cocoapods.org/pods/XCDYouTubeKit) [![Carthage Compatibility](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage/) From 227325b67ec0dc144e92ff78f888fa09b3fe128c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Tue, 30 Jul 2019 16:37:33 -0400 Subject: [PATCH 5/5] Point badges to the develop branch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 962759154..c74502f7e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## About -[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/master.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) -[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/master.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/master) +[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) +[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/develop) [![Platform](https://img.shields.io/cocoapods/p/XCDYouTubeKit.svg?style=flat)](http://cocoadocs.org/docsets/XCDYouTubeKit/) [![Pod Version](https://img.shields.io/cocoapods/v/XCDYouTubeKit.svg?style=flat)](https://cocoapods.org/pods/XCDYouTubeKit) [![Carthage Compatibility](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage/)