From d626080ff965a115ccb348eb2ce7d1507743af91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Thu, 23 Jan 2020 19:22:10 -0400 Subject: [PATCH 1/6] Add new script pattern (fixes #458) From https://github.com/ytdl-org/youtube-dl/commit/c3cfea906869e8358652e382679a5996c2aec73e --- XCDYouTubeKit/XCDYouTubePlayerScript.m | 1 + 1 file changed, 1 insertion(+) diff --git a/XCDYouTubeKit/XCDYouTubePlayerScript.m b/XCDYouTubeKit/XCDYouTubePlayerScript.m index cf67f2c8..da040dac 100644 --- a/XCDYouTubeKit/XCDYouTubePlayerScript.m +++ b/XCDYouTubeKit/XCDYouTubePlayerScript.m @@ -76,6 +76,7 @@ - (instancetype) initWithString:(NSString *)string //See list of regex patterns here https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L1179 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*\\)", @"([\"\\\'])signature\\1\\s*,\\s*([a-zA-Z0-9$]+)\\(", @"\\.sig\\|\\|([a-zA-Z0-9$]+)\\(", From 756eba77d9deee9de3977e819be71da2c80aeee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Thu, 23 Jan 2020 19:28:35 -0400 Subject: [PATCH 2/6] Add comment on importance of pattern order --- XCDYouTubeKit/XCDYouTubePlayerScript.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/XCDYouTubeKit/XCDYouTubePlayerScript.m b/XCDYouTubeKit/XCDYouTubePlayerScript.m index da040dac..a90fa19b 100644 --- a/XCDYouTubeKit/XCDYouTubePlayerScript.m +++ b/XCDYouTubeKit/XCDYouTubePlayerScript.m @@ -73,11 +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$]+)\\(", From 1623316919cbba5836e4c60d671259ce32bfce12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Thu, 23 Jan 2020 19:34:54 -0400 Subject: [PATCH 3/6] Update CHANGELOG for version 2.8.3 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab2fccfe..a9d55f73 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` From 56772b0aa02465a60ff033a3379f65c04cd70b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Thu, 23 Jan 2020 19:34:59 -0400 Subject: [PATCH 4/6] Update version to 2.8.3 --- .jazzy.yaml | 4 ++-- .../project.pbxproj | 4 ++-- .../xcschemes/xcschememanagement.plist | 24 +++++++++++++++++++ XCDYouTubeKit.podspec | 2 +- XCDYouTubeKit.xcodeproj/project.pbxproj | 8 +++---- .../xcschemes/xcschememanagement.plist | 24 +++++++++++++++++++ 6 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 XCDYouTubeKit.xcodeproj/xcuserdata/soneejohn.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/.jazzy.yaml b/.jazzy.yaml index b77ba069..b6242e76 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/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj index 7d386775..dc340c77 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 00000000..870f8012 --- /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 3636cc32..e636f55e 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 9e5a0946..6026be39 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 00000000..0a0f2843 --- /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 + + + + From ac35b7d6873783539b78b7faaada45f4ea9bdf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Thu, 23 Jan 2020 19:34:59 -0400 Subject: [PATCH 5/6] Point badges to the master branch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5934df22..0515f3df 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## About -[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) -[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/develop) +[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/master.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) +[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/master.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/master) [![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/) From ef277186f0a4c062aa6232e0d8907125b90fe51f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Thu, 23 Jan 2020 19:36:11 -0400 Subject: [PATCH 6/6] Point badges to the develop branch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0515f3df..5934df22 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## About -[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/master.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) -[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/master.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/master) +[![Build Status](https://img.shields.io/circleci/project/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://circleci.com/gh/0xced/XCDYouTubeKit) +[![Coverage Status](https://img.shields.io/codecov/c/github/0xced/XCDYouTubeKit/develop.svg?style=flat)](https://codecov.io/gh/0xced/XCDYouTubeKit/branch/develop) [![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/)