Skip to content

Commit

Permalink
Merge branch 'release/2.5.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Jun 24, 2016
2 parents 138a0be + 0bb5029 commit 020a4aa
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 254 deletions.
14 changes: 14 additions & 0 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
objc: true
sdk: iphonesimulator
source_directory: XCDYouTubeKit
framework_root: .
umbrella_header: XCDYouTubeKit/XCDYouTubeKit.h
module: XCDYouTubeKit
module_version: 2.5.2

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.5.2/XCDYouTubeKit
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
osx_image: xcode7.2
osx_image: xcode7.3
language: objective-c
env:
matrix:
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Code Coverage" SCHEME="XCDYouTubeKit iOS Static Library" OBJROOT="build"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.1" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=8.4" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.0" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.2" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.2" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" IPHONEOS_DEPLOYMENT_TARGET="9.2"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.3" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.3" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" IPHONEOS_DEPLOYMENT_TARGET="9.3"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 4s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Static Library" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 4s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=iOS Simulator,name=iPhone 5s" CONFIGURATION="Release" SCHEME="XCDYouTubeKit iOS Framework" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=OS X" CONFIGURATION="Release" SCHEME="XCDYouTubeKit OS X" RUN_CLANG_STATIC_ANALYZER="YES"'
- 'DESTINATION="platform=OS X" CONFIGURATION="Release" SCHEME="XCDYouTubeKit OS X" MACOSX_DEPLOYMENT_TARGET="10.11"'
- 'DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p" CONFIGURATION="Release" SCHEME="XCDYouTubeKit tvOS" RUN_CLANG_STATIC_ANALYZER="YES"'
before_install:
- xcrun simctl list
install:
- gem install xcpretty-travis-formatter --no-rdoc --no-ri --no-document --quiet
- sudo easy_install cpp-coveralls
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### Version 2.5.3

* Adaptation to YouTube API change. (#257)

#### Version 2.5.2

* Ensure that all the streams are downloadable at full speed. (#177)
Expand Down
1 change: 0 additions & 1 deletion Scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ echo "Things remaining to do"
echo " * git push with tags (master and develop)"
echo " * check that build is passing on travis: https://travis-ci.org/0xced/XCDYouTubeKit/"
echo " * pod trunk push XCDYouTubeKit.podspec"
echo " * pod spec lint XCDYouTubeKit.podspec"
echo " * create a new release on GitHub: https://github.com/0xced/XCDYouTubeKit/releases/new"
echo " * close milestone on GitHub if applicable: https://github.com/0xced/XCDYouTubeKit/milestones"
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.5.2;
CURRENT_PROJECT_VERSION = 2.5.3;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down Expand Up @@ -805,7 +805,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 2.5.2;
CURRENT_PROJECT_VERSION = 2.5.3;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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.5.2"
s.version = "2.5.3"
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
12 changes: 6 additions & 6 deletions XCDYouTubeKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1157,10 +1157,10 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 24;
CURRENT_PROJECT_VERSION = 25;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.5.2;
DYLIB_CURRENT_VERSION = 2.5.3;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -1223,10 +1223,10 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 24;
CURRENT_PROJECT_VERSION = 25;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.5.2;
DYLIB_CURRENT_VERSION = 2.5.3;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -1296,10 +1296,10 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 24;
CURRENT_PROJECT_VERSION = 25;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.5.2;
DYLIB_CURRENT_VERSION = 2.5.3;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down
30 changes: 22 additions & 8 deletions XCDYouTubeKit/XCDYouTubePlayerScript.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ - (instancetype) initWithString:(NSString *)string
if (!(self = [super init]))
return nil; // LCOV_EXCL_LINE

NSString *script = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSRegularExpression *anonymousFunctionRegularExpression = [NSRegularExpression regularExpressionWithPattern:@"\\(function\\([^)]*\\)\\{(.*)\\}\\)\\([^)]*\\)" options:NSRegularExpressionDotMatchesLineSeparators error:NULL];
NSTextCheckingResult *anonymousFunctionResult = [anonymousFunctionRegularExpression firstMatchInString:script options:(NSMatchingOptions)0 range:NSMakeRange(0, script.length)];
if (anonymousFunctionResult.numberOfRanges > 1)
script = [script substringWithRange:[anonymousFunctionResult rangeAtIndex:1]];
else
XCDYouTubeLogWarning(@"Unexpected player script (no anonymous function found)");

_context = [JSContext new];
_context.exceptionHandler = ^(JSContext *context, JSValue *exception) {
XCDYouTubeLogWarning(@"JavaScript exception: %@", exception);
Expand All @@ -52,8 +44,30 @@ - (instancetype) initWithString:(NSString *)string
_context[@"window"][propertyName] = value;
}

NSString *script = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[_context evaluateScript:script];

NSRegularExpression *anonymousFunctionRegularExpression = [NSRegularExpression regularExpressionWithPattern:@"\\(function\\(([^)]*)\\)\\{(.*)\\}\\)\\(([^)]*)\\)" options:NSRegularExpressionDotMatchesLineSeparators error:NULL];
NSTextCheckingResult *anonymousFunctionResult = [anonymousFunctionRegularExpression firstMatchInString:script options:(NSMatchingOptions)0 range:NSMakeRange(0, script.length)];
if (anonymousFunctionResult.numberOfRanges > 3)
{
NSArray *parameters = [[script substringWithRange:[anonymousFunctionResult rangeAtIndex:1]] componentsSeparatedByString:@","];
NSArray *arguments = [[script substringWithRange:[anonymousFunctionResult rangeAtIndex:3]] componentsSeparatedByString:@","];
if (parameters.count == arguments.count)
{
for (NSUInteger i = 0; i < parameters.count; i++)
{
_context[parameters[i]] = _context[arguments[i]];
}
}
NSString *anonymousFunctionBody = [script substringWithRange:[anonymousFunctionResult rangeAtIndex:2]];
[_context evaluateScript:anonymousFunctionBody];
}
else
{
XCDYouTubeLogWarning(@"Unexpected player script (no anonymous function found)");
}

NSRegularExpression *signatureRegularExpression = [NSRegularExpression regularExpressionWithPattern:@"[\"']signature[\"']\\s*,\\s*([^\\(]+)" options:NSRegularExpressionCaseInsensitive error:NULL];
NSTextCheckingResult *signatureResult = [signatureRegularExpression firstMatchInString:script options:(NSMatchingOptions)0 range:NSMakeRange(0, script.length)];
NSString *signatureFunctionName = signatureResult.numberOfRanges > 1 ? [script substringWithRange:[signatureResult rangeAtIndex:1]] : nil;
Expand Down

1 comment on commit 020a4aa

@Noodlekim
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!! It is working!

Please sign in to comment.