Skip to content

Commit

Permalink
Merge branch 'release/2.7.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
SoneeJohn committed Jul 30, 2019
2 parents 6db8069 + 227325b commit 679ba67
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion XCDYouTubeKit.podspec
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 4 additions & 4 deletions XCDYouTubeKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions XCDYouTubeKit/XCDYouTubeVideo+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()

Expand Down
17 changes: 15 additions & 2 deletions XCDYouTubeKit/XCDYouTubeVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];

Expand All @@ -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;
Expand Down

0 comments on commit 679ba67

Please sign in to comment.