Skip to content

Commit

Permalink
Merge branch 'release/2.15.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
SoneeJohn committed Oct 27, 2020
2 parents 33211f1 + da9d5a1 commit b35528d
Show file tree
Hide file tree
Showing 34 changed files with 1,145 additions and 611 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.14.1
module_version: 2.15.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.14.1/XCDYouTubeKit
github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.15.0/XCDYouTubeKit
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#### Version 2.15.0

* Adaptation to YouTube API change (#501)
* New `XCDYouTubeErrorUnknown` error code (#484, #491)
* New `XCDYouTubeErrorTooManyRequests` error code ([comment](https://github.com/0xced/XCDYouTubeKit/issues/501#issuecomment-716812836))
* Improve error message for `XCDYouTubeErrorNoStreamAvailable` code
* Remove platforms in Swift Package Manager (#496)

#### Version 2.14.1

* Adaptation to YouTube API change. (#487)
Expand Down
5 changes: 0 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import PackageDescription

let package = Package(
name: "XCDYouTubeKit",
platforms: [
.iOS(.v8),
.tvOS(.v9),
.macOS(.v10_10)
],
products: [
.library(name: "XCDYouTubeKit", targets: ["XCDYouTubeKit"])
],
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ XCDYouTubeKit is available through [CocoaPods](https://cocoapods.org/), [Carthag
CocoaPods:

```ruby
pod "XCDYouTubeKit", "~> 2.14"
pod "XCDYouTubeKit", "~> 2.15"
```

Carthage:

```objc
github "0xced/XCDYouTubeKit" ~> 2.14
github "0xced/XCDYouTubeKit" ~> 2.15
```

Swift Package Manager:
Expand All @@ -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.14.0")
.package(url: "https://github.com/0xced/XCDYouTubeKit.git", from: "2.15.0")
]
```

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.14.1;
CURRENT_PROJECT_VERSION = 2.15.0;
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.14.1;
CURRENT_PROJECT_VERSION = 2.15.0;
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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[
{
"body" : "<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\">\n<html>\n<head><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\"><meta name=\"viewport\" content=\"initial-scale=1\"><title>https:\/\/www.youtube.com\/embed\/V_xRSxKE1jg<\/title><\/head>\n<body style=\"font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;\" onload=\"e=document.getElementById('captcha');if(e){e.focus();}\">\n<div style=\"max-width:400px;\">\n<hr noshade size=\"1\" style=\"color:#ccc; background-color:#ccc;\"><br>\n<form id=\"captcha-form\" action=\"index\" method=\"post\">\n<script src=\"https:\/\/www.google.com\/recaptcha\/api.js\" async defer><\/script>\n<script>var submitCallback = function(response) {document.getElementById('captcha-form').submit();};<\/script>\n<div id=\"recaptcha\" class=\"g-recaptcha\" data-sitekey=\"6LfwuyUTAAAAAOAmoS0fdqijC2PbbdH4kjq62Y1b\" data-callback=\"submitCallback\" data-s=\"38yolpcWfPtcA8WY_X3aTCQILxPVllijKtyGQ5wQiEP_p3V_FzzjJT_dv9VzZRWgCe04BamqbPFMOjPDibAyAMkNzWs-tNGGoM2Gff19OVj0q4L9zJA8QYlek_AiDD3paTg5HHdPgdTcMGazDoiI7iqjmxMKNlfsujevgvi1o9pRszaLFRPT7x5NnuFig2vrC7dv6z95FVrLtcM-5WxXpn1Lr1MzfEBXt7J6jaE2HsagDNuwGVxr9OI\"><\/div>\n<input type='hidden' name='q' value='EgTBJOA6GLOn4PwFIhkA8aeDS92W4Lxls2YEETTkPHAA2XcgQtsnMgFy'><input type=\"hidden\" name=\"continue\" value=\"https:\/\/www.youtube.com\/embed\/V_xRSxKE1jg\">\n<\/form>\n<hr noshade size=\"1\" style=\"color:#ccc; background-color:#ccc;\">\n\n<div style=\"font-size:13px;\">\n<b>About this page<\/b><br><br>\n\nOur systems have detected unusual traffic from your computer network. This page checks to see if it&#39;s really you sending the requests, and not a robot. <a href=\"#\" onclick=\"document.getElementById('infoDiv').style.display='block';\">Why did this happen?<\/a><br><br>\n\n<div id=\"infoDiv\" style=\"display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;\">\nThis page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the <a href=\"\/\/www.google.com\/policies\/terms\/\">Terms of Service<\/a>. The block will expire shortly after those requests stop. In the meantime, solving the above CAPTCHA will let you continue to use our services.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests. If you share your network connection, ask your administrator for help &mdash; a different computer using the same IP address may be responsible. <a href=\"\/\/support.google.com\/websearch\/answer\/86640\">Learn more<\/a><br><br>Sometimes you may be asked to solve the CAPTCHA if you are using advanced terms that robots are known to use, or sending requests very quickly.\n<\/div>\n\nIP address: 193.36.224.58<br>Time: 2020-10-27T12:33:55Z<br>URL: https:\/\/www.youtube.com\/embed\/V_xRSxKE1jg<br>\n<\/div>\n<\/div>\n<\/body>\n<\/html>\n",
"headers" : {
"Pragma" : "no-cache",
"Server" : "HTTP server (unknown)",
"Content-Type" : "text\/html",
"Expires" : "Fri, 01 Jan 1990 00:00:00 GMT",
"Date" : "Tue, 27 Oct 2020 12:33:55 GMT",
"X-XSS-Protection" : "0",
"Alt-Svc" : "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
"Content-Length" : "2854",
"Cache-Control" : "no-store, no-cache, must-revalidate"
},
"method" : "GET",
"status" : 429,
"uri" : "https:\/\/www.youtube.com\/embed\/V_xRSxKE1jg"
},
{
"body" : "<html><head><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\"\/><title>Sorry...<\/title><style> body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }<\/style><\/head><body><div><table><tr><td><b><font face=sans-serif size=10><font color=#4285f4>G<\/font><font color=#ea4335>o<\/font><font color=#fbbc05>o<\/font><font color=#4285f4>g<\/font><font color=#34a853>l<\/font><font color=#ea4335>e<\/font><\/font><\/b><\/td><td style=\"text-align: left; vertical-align: bottom; padding-bottom: 15px; width: 50%\"><div style=\"border-bottom: 1px solid #dfdfdf;\">Sorry...<\/div><\/td><\/tr><\/table><\/div><div style=\"margin-left: 4em;\"><h1>We're sorry...<\/h1><p>... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.<\/p><\/div><div style=\"margin-left: 4em;\">See <a href=\"https:\/\/support.google.com\/websearch\/answer\/86640\">Google Help<\/a> for more information.<br\/><br\/><\/div><div style=\"text-align: center; border-top: 1px solid #dfdfdf;\"><a href=\"https:\/\/www.google.com\">Google Home<\/a><\/div><\/body><\/html>",
"headers" : {
"Alt-Svc" : "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
"Content-Type" : "text\/html; charset=UTF-8",
"Content-Length" : "1103",
"Date" : "Tue, 27 Oct 2020 12:33:54 GMT"
},
"method" : "GET",
"status" : 429,
"uri" : "https:\/\/www.youtube.com\/get_video_info?el=embedded&hl=en&ps=default&video_id=V_xRSxKE1jg"
},
{
"body" : "<html><head><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\"\/><title>Sorry...<\/title><style> body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }<\/style><\/head><body><div><table><tr><td><b><font face=sans-serif size=10><font color=#4285f4>G<\/font><font color=#ea4335>o<\/font><font color=#fbbc05>o<\/font><font color=#4285f4>g<\/font><font color=#34a853>l<\/font><font color=#ea4335>e<\/font><\/font><\/b><\/td><td style=\"text-align: left; vertical-align: bottom; padding-bottom: 15px; width: 50%\"><div style=\"border-bottom: 1px solid #dfdfdf;\">Sorry...<\/div><\/td><\/tr><\/table><\/div><div style=\"margin-left: 4em;\"><h1>We're sorry...<\/h1><p>... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.<\/p><\/div><div style=\"margin-left: 4em;\">See <a href=\"https:\/\/support.google.com\/websearch\/answer\/86640\">Google Help<\/a> for more information.<br\/><br\/><\/div><div style=\"text-align: center; border-top: 1px solid #dfdfdf;\"><a href=\"https:\/\/www.google.com\">Google Home<\/a><\/div><\/body><\/html>",
"headers" : {
"Alt-Svc" : "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
"Content-Type" : "text\/html; charset=UTF-8",
"Content-Length" : "1103",
"Date" : "Tue, 27 Oct 2020 12:33:54 GMT"
},
"method" : "GET",
"status" : 429,
"uri" : "https:\/\/www.youtube.com\/get_video_info?el=detailpage&hl=en&ps=default&video_id=V_xRSxKE1jg"
},
{
"body" : "<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\">\n<html>\n<head><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\"><meta name=\"viewport\" content=\"initial-scale=1\"><title>https:\/\/www.youtube.com\/watch?bpctr=9999999999&amp;has_verified=1&amp;hl=en&amp;v=V_xRSxKE1jg<\/title><\/head>\n<body style=\"font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;\" onload=\"e=document.getElementById('captcha');if(e){e.focus();}\">\n<div style=\"max-width:400px;\">\n<hr noshade size=\"1\" style=\"color:#ccc; background-color:#ccc;\"><br>\n<form id=\"captcha-form\" action=\"index\" method=\"post\">\n<script src=\"https:\/\/www.google.com\/recaptcha\/api.js\" async defer><\/script>\n<script>var submitCallback = function(response) {document.getElementById('captcha-form').submit();};<\/script>\n<div id=\"recaptcha\" class=\"g-recaptcha\" data-sitekey=\"6LfwuyUTAAAAAOAmoS0fdqijC2PbbdH4kjq62Y1b\" data-callback=\"submitCallback\" data-s=\"NLTtZ1MnluWVewj4yB-iDJDDUCoWK5TJinHbM1UHHz1IoSBapU2WelZFieFu4F5ExcN79Ui-2_73G8SA3gdrs_edihiWI3Op2rxWUeIIAcsOWn_iLWP2zwQcYlsGsm7Th-FVItK6w1PoB8g6ewVwly7DvK8yQ4ag0UcDxajV4ud6L49x4neGuSQ1Xho7RvtReoUFv23wt-ePjADdokeEs8OzzH7W2f8kk10n3kGloRBwE1IlcX6Ozv0\"><\/div>\n<input type='hidden' name='q' value='EgTBJOA6GLOn4PwFIhkA8aeDS7XLD4cHIxQjQR2L90UZ77lAFSwHMgFy'><input type=\"hidden\" name=\"continue\" value=\"https:\/\/www.youtube.com\/watch?bpctr=9999999999&amp;has_verified=1&amp;hl=en&amp;v=V_xRSxKE1jg\">\n<\/form>\n<hr noshade size=\"1\" style=\"color:#ccc; background-color:#ccc;\">\n\n<div style=\"font-size:13px;\">\n<b>About this page<\/b><br><br>\n\nOur systems have detected unusual traffic from your computer network. This page checks to see if it&#39;s really you sending the requests, and not a robot. <a href=\"#\" onclick=\"document.getElementById('infoDiv').style.display='block';\">Why did this happen?<\/a><br><br>\n\n<div id=\"infoDiv\" style=\"display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;\">\nThis page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the <a href=\"\/\/www.google.com\/policies\/terms\/\">Terms of Service<\/a>. The block will expire shortly after those requests stop. In the meantime, solving the above CAPTCHA will let you continue to use our services.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests. If you share your network connection, ask your administrator for help &mdash; a different computer using the same IP address may be responsible. <a href=\"\/\/support.google.com\/websearch\/answer\/86640\">Learn more<\/a><br><br>Sometimes you may be asked to solve the CAPTCHA if you are using advanced terms that robots are known to use, or sending requests very quickly.\n<\/div>\n\nIP address: 193.36.224.58<br>Time: 2020-10-27T12:33:56Z<br>URL: https:\/\/www.youtube.com\/watch?bpctr=9999999999&amp;has_verified=1&amp;hl=en&amp;v=V_xRSxKE1jg<br>\n<\/div>\n<\/div>\n<\/body>\n<\/html>\n",
"headers" : {
"Pragma" : "no-cache",
"Server" : "HTTP server (unknown)",
"Content-Type" : "text\/html",
"Expires" : "Fri, 01 Jan 1990 00:00:00 GMT",
"Date" : "Tue, 27 Oct 2020 12:33:56 GMT",
"X-XSS-Protection" : "0",
"Alt-Svc" : "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
"Content-Length" : "3010",
"Cache-Control" : "no-store, no-cache, must-revalidate"
},
"method" : "GET",
"status" : 429,
"uri" : "https:\/\/www.youtube.com\/watch?bpctr=9999999999&has_verified=1&hl=en&v=V_xRSxKE1jg"
}
]

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.

23 changes: 21 additions & 2 deletions XCDYouTubeKit Tests/XCDYouTubeClientTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,25 @@ - (void) testRestrictedVideo
setenv("XCDYouTubeKitLogLevel", logLevel, 1);
}

//One crude way to get this error to trigger for testing is to execute a ton of operations in a for loop
//However, you can also do this with a tool like Charles Proxy and returning a 429 status code for every request to youtube.com
- (void) testTooManyRequestsError
{
__weak XCTestExpectation *expectation = [self expectationWithDescription:@""];
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:@"V_xRSxKE1jg" completionHandler:^(XCDYouTubeVideo *video, NSError *error)
{
NSError *underlyingError = error.userInfo[NSUnderlyingErrorKey];
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorNetwork);
XCTAssertEqual(underlyingError.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(underlyingError.code, XCDYouTubeErrorTooManyRequests);
XCTAssertEqualObjects(error.localizedDescription, @"The operation couldn’t be completed because too many requests were sent.");
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:5 handler:nil];
}

- (void) testRemovedVideo
{
__weak XCTestExpectation *expectation = [self expectationWithDescription:@""];
Expand Down Expand Up @@ -707,7 +726,7 @@ - (void) testNonExistentVideoIdentifier
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"This video is unavailable.");
XCTAssertEqualObjects(error.localizedDescription, @"Video unavailable");
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:5 handler:nil];
Expand All @@ -721,7 +740,7 @@ - (void) testFrenchClient
XCTAssertNil(video);
XCTAssertEqualObjects(error.domain, XCDYouTubeVideoErrorDomain);
XCTAssertEqual(error.code, XCDYouTubeErrorNoStreamAvailable);
XCTAssertEqualObjects(error.localizedDescription, @"Cette vidéo n'est pas disponible.");
XCTAssertEqualObjects(error.localizedDescription, @"Vidéo non disponible");
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:5 handler:nil];
Expand Down
Loading

0 comments on commit b35528d

Please sign in to comment.