Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhifeng-huang committed Oct 14, 2019
2 parents 3b5242b + 7b4c57a commit 543edad
Show file tree
Hide file tree
Showing 57 changed files with 1,562 additions and 909 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
XcodeCoverage
RELEASE_NOTES.md
.DS_Store
*.xcuserstate
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.5
module_version: 2.8.1

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.5/XCDYouTubeKit
github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.8.1/XCDYouTubeKit
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
#### Version 2.8.1

* Adaptation to YouTube API change. (#447, #448, #449)

#### Version 2.8.0

* Adaptation to YouTube API change.
* Deprecated `XCDYouTubeErrorRestrictedPlayback` & `XCDYouTubeErrorInvalidVideoIdentifier` use `XCDYouTubeErrorNoStreamAvailable` instead.

#### Version 2.7.8

* Adaptation to YouTube API change. (#443)

#### Version 2.7.7

* Add another player script regular expression (#438)

#### Version 2.7.6

* Adaptation to YouTube API change. (#437)

#### Version 2.7.5

* Adaptation to YouTube API change. (#433)
Expand Down
16 changes: 16 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// swift-tools-version:4.2
import PackageDescription

let package = Package(
name: "XCDYouTubeKit",
// platforms: [.iOS("8.0"), .macOS("10.10"), tvOS("9.0")],
products: [
.library(name: "XCDYouTubeKit", targets: ["XCDYouTubeKit"])
],
targets: [
.target(
name: "XCDYouTubeKit",
path: "XCDYouTubeKit"
)
]
)
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![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/)
[![Accio supported](https://img.shields.io/badge/Accio-supported-0A7CF5.svg?style=flat)](https://github.com/JamitLabs/Accio)
[![License](https://img.shields.io/cocoapods/l/XCDYouTubeKit.svg?style=flat)](LICENSE)

**XCDYouTubeKit** is a YouTube video player for iOS, tvOS and macOS.
Expand All @@ -27,18 +28,24 @@ XCDYouTubeKit is against the YouTube [Terms of Service](https://www.youtube.com/

## Installation

XCDYouTubeKit is available through CocoaPods and Carthage.
XCDYouTubeKit is available through [CocoaPods](https://cocoapods.org/), [Carthage](https://github.com/Carthage/Carthage) and [Accio](https://github.com/JamitLabs/Accio).

CocoaPods:

```ruby
pod "XCDYouTubeKit", "~> 2.7"
pod "XCDYouTubeKit", "~> 2.8"
```

Carthage:

```objc
github "0xced/XCDYouTubeKit" ~> 2.7
github "0xced/XCDYouTubeKit" ~> 2.8
```

Accio:

```swift
.package(url: "https://github.com/0xced/XCDYouTubeKit.git", .upToNextMajor(from: "2.7.3")),
```

Alternatively, you can manually use the provided static library or dynamic framework. In order to use the static library, you must:
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.5;
CURRENT_PROJECT_VERSION = 2.8.1;
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.5;
CURRENT_PROJECT_VERSION = 2.8.1;
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.

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.

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.

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.

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.

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.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file added XCDYouTubeKit Tests/Cookies/UserCookieData
Binary file not shown.
Binary file removed XCDYouTubeKit Tests/Cookies/adultUserCookieData
Binary file not shown.
Binary file removed XCDYouTubeKit Tests/Cookies/minorUserCookieData
Binary file not shown.
3 changes: 3 additions & 0 deletions XCDYouTubeKit Tests/VCRURLConnection/VCRURLConnection/VCR.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
*/
+ (void)save:(NSString *)path;

+ (NSArray<NSHTTPCookie *>*)cookies;
+ (void)setCookies:(NSArray<NSHTTPCookie *>*)cookies;

@end
14 changes: 14 additions & 0 deletions XCDYouTubeKit Tests/VCRURLConnection/VCRURLConnection/VCR.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

static BOOL _VCRIsRecording;
static BOOL _VCRIsReplaying;
static NSArray *_VCRCookies;


@implementation VCR
Expand Down Expand Up @@ -76,6 +77,9 @@ + (void)start {
}

+ (void)stop {
for (NSHTTPCookie *cookie in [NSHTTPCookieStorage sharedHTTPCookieStorage].cookies) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage]deleteCookie:cookie];
}
[self setRecording:NO];
[self setReplaying:NO];
}
Expand All @@ -84,6 +88,16 @@ + (void)save:(NSString *)path {
return [[VCRCassetteManager defaultManager] save:path];
}

+ (NSArray<NSHTTPCookie *> *)cookies {
return _VCRCookies;
}

+ (void)setCookies:(NSArray<NSHTTPCookie *> *)cookies {
if (_VCRCookies != cookies) {
_VCRCookies = cookies;
}
}

@end


Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ + (BOOL)canInitWithRequest:(NSURLRequest *)request {
}

+ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request {
for (NSHTTPCookie *cookie in [VCR cookies]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage]setCookie:cookie];
}
return request;
}

Expand Down
20 changes: 10 additions & 10 deletions XCDYouTubeKit Tests/XCDYouTubeClientTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ - (void) testExpiredLiveVideo
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:@"i2-MnWWoL6M" completionHandler:^(XCDYouTubeVideo *video, NSError *error) {
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorRestrictedPlayback);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"This live stream recording is not available.");
[expectation fulfill];
}];
Expand All @@ -196,7 +196,7 @@ - (void) testRestrictedVideo
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorRestrictedPlayback);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"This video is no longer available because the YouTube account associated with this video has been terminated.");
[expectation fulfill];
}];
Expand All @@ -213,8 +213,8 @@ - (void) testRemovedVideo
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorRestrictedPlayback);
XCTAssertEqualObjects(error.localizedDescription, @"\"9/11 The F...\" is no longer available due to a copyright claim by Digital Rights Group Ltd.");
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"This video has been removed for violating YouTube's Terms of Service.");
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:5 handler:nil];
Expand All @@ -227,7 +227,7 @@ - (void) testGeoblockedVideo
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorRestrictedPlayback);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"The uploader has not made this video available in your country.");
[expectation fulfill];
}];
Expand All @@ -241,7 +241,7 @@ - (void) testInvalidVideoIdentifier
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorInvalidVideoIdentifier);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"Invalid parameters.");
[expectation fulfill];
}];
Expand All @@ -255,7 +255,7 @@ - (void) testNonExistentVideoIdentifier
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorRestrictedPlayback);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"This video is unavailable.");
[expectation fulfill];
}];
Expand All @@ -269,7 +269,7 @@ - (void) testFrenchClient
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorRestrictedPlayback);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"Cette vidéo n'est pas disponible.");
[expectation fulfill];
}];
Expand All @@ -283,7 +283,7 @@ - (void) testNilVideoIdentifier
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorInvalidVideoIdentifier);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"Invalid parameters.");
[expectation fulfill];
}];
Expand All @@ -297,7 +297,7 @@ - (void) testSpaceVideoIdentifier
{
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorInvalidVideoIdentifier);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"Invalid parameters.");
[expectation fulfill];
}];
Expand Down
2 changes: 2 additions & 0 deletions XCDYouTubeKit Tests/XCDYouTubeKitTestCase.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
#import "VCRCassetteManager.h"

@interface XCDYouTubeKitTestCase : XCTestCase
- (void) setUpTestWithSelector:(SEL)selector;
@property NSArray<NSHTTPCookie *>*cookies;
@end
1 change: 1 addition & 0 deletions XCDYouTubeKit Tests/XCDYouTubeKitTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ + (NSArray *) testInvocations
- (void) setUpTestWithSelector:(SEL)selector
{
[super setUpTestWithSelector:selector];
[VCR setCookies:self.cookies];

BOOL onlineTests = [[[[NSProcessInfo processInfo] environment] objectForKey:@"ONLINE_TESTS"] boolValue];

Expand Down
Loading

0 comments on commit 543edad

Please sign in to comment.