diff --git a/.jazzy.yaml b/.jazzy.yaml
index b77ba069c..b6242e766 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.8.2
+module_version: 2.8.3
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.8.2/XCDYouTubeKit
+github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.8.3/XCDYouTubeKit
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab2fccfe9..a9d55f73a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+#### Version 2.8.3
+
+* Adaptation to YouTube API change. (#458)
+
#### Version 2.8.2
* Add new `streamURL` property on `XCDYouTubeVideo`
diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj
index 7d3867755..dc340c775 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.8.2;
+ CURRENT_PROJECT_VERSION = 2.8.3;
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.8.2;
+ CURRENT_PROJECT_VERSION = 2.8.3;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 000000000..870f80121
--- /dev/null
+++ b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,24 @@
+
+
+
+
+ SchemeUserState
+
+ XCDYouTubeKit OS X Demo.xcscheme_^#shared#^_
+
+ orderHint
+ 2
+
+ XCDYouTubeKit iOS Demo.xcscheme_^#shared#^_
+
+ orderHint
+ 1
+
+ XCDYouTubeKit tvOS Demo.xcscheme_^#shared#^_
+
+ orderHint
+ 5
+
+
+
+
diff --git a/XCDYouTubeKit.podspec b/XCDYouTubeKit.podspec
index 3636cc32b..e636f55e2 100644
--- a/XCDYouTubeKit.podspec
+++ b/XCDYouTubeKit.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "XCDYouTubeKit"
- s.version = "2.8.2"
+ s.version = "2.8.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"
diff --git a/XCDYouTubeKit.xcodeproj/project.pbxproj b/XCDYouTubeKit.xcodeproj/project.pbxproj
index 9e5a0946e..6026be39a 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 = 41;
+ CURRENT_PROJECT_VERSION = 42;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
- DYLIB_CURRENT_VERSION = 2.8.2;
+ DYLIB_CURRENT_VERSION = 2.8.3;
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 = 41;
+ CURRENT_PROJECT_VERSION = 42;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
- DYLIB_CURRENT_VERSION = 2.8.2;
+ DYLIB_CURRENT_VERSION = 2.8.3;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
diff --git a/XCDYouTubeKit.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist b/XCDYouTubeKit.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 000000000..0a0f2843e
--- /dev/null
+++ b/XCDYouTubeKit.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,24 @@
+
+
+
+
+ SchemeUserState
+
+ XCDYouTubeKit Framework.xcscheme_^#shared#^_
+
+ orderHint
+ 0
+
+ XCDYouTubeKit Static Library.xcscheme_^#shared#^_
+
+ orderHint
+ 3
+
+ XCDYouTubeKit Tests.xcscheme_^#shared#^_
+
+ orderHint
+ 4
+
+
+
+
diff --git a/XCDYouTubeKit/XCDYouTubePlayerScript.m b/XCDYouTubeKit/XCDYouTubePlayerScript.m
index cf67f2c85..a90fa19bd 100644
--- a/XCDYouTubeKit/XCDYouTubePlayerScript.m
+++ b/XCDYouTubeKit/XCDYouTubePlayerScript.m
@@ -73,10 +73,15 @@ - (instancetype) initWithString:(NSString *)string
XCDYouTubeLogWarning(@"Unexpected player script (no anonymous function found)");
}
- //See list of regex patterns here https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L1179
+ //See list of regex patterns here https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L1344
NSArray*patterns = @[@"\\b[cs]\\s*&&\\s*[adf]\\.set\\([^,]+\\s*,\\s*encodeURIComponent\\s*\\(\\s*([a-zA-Z0-9$]+)\\(",
@"\\b[a-zA-Z0-9]+\\s*&&\\s*[a-zA-Z0-9]+\\.set\\([^,]+\\s*,\\s*encodeURIComponent\\s*\\(\\s*([a-zA-Z0-9$]+)\\(",
+ @"\\b([a-zA-Z0-9$]{2})\\s*=\\s*function\\(\\s*a\\s*\\)\\s*\\{\\s*a\\s*=\\s*a\\.split\\(\\s*\"\"\\s*\\)",
@"([a-zA-Z0-9$]+)\\s*=\\s*function\\(\\s*a\\s*\\)\\s*\\{\\s*a\\s*=\\s*a\\.split\\(\\s*\"\"\\s*\\)",
+ /*The rest patterns are supposed to be obsolete but I am keep them here in case some older pattern matches the YouTube API in the future
+ * IMPORTANT: Please note that the patterns above should be placed in the same order as seen in youtube-dl here: https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L1344
+ * If they do not match the same order some video won't play because of using the wrong signature.
+ */
@"([\"\\\'])signature\\1\\s*,\\s*([a-zA-Z0-9$]+)\\(",
@"\\.sig\\|\\|([a-zA-Z0-9$]+)\\(",
@"yt\\.akamaized\\.net/\\)\\s*\\|\\|\\s*.*?\\s*[cs]\\s*&&\\s*[adf]\\.set\\([^,]+\\s*,\\s*(?:encodeURIComponent\\s*\\()?\\s*([a-zA-Z0-9$]+)\\(",