diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..ceced123 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,32 @@ +version: 2 +jobs: + build: + macos: + xcode: '10.2.1' + environment: + LANG: en_US.UTF-8 + LC_ALL: en_US.UTF-8 + FASTLANE_DISABLE_ANIMATION: 1 + FASTLANE_SKIP_UPDATE_CHECK: 1 + SKIP_SLOW_FASTLANE_WARNING: 1 + steps: + - checkout + - run: xcodebuild -version -sdk + - run: xcrun simctl list + - run: make test_macOS + - run: make test_tvOS + - run: make test_iOS + - run: make test_macOS_report + - run: make test_tvOS_report + - run: make test_iOS_report + - run: + name: Upload to CodeCov + command: bash <(curl -s https://codecov.io/bash) -J XCDYouTubeKit -X coveragepy -X gcov -X xcodeplist -X xcodepartials + - store_test_results: + path: test_reports + - store_artifacts: + path: /Users/distiller/Library/Developer/Xcode/DerivedData/XCDYouTubeKit-byvnmvumvdztmngymdsxlhlsgpgd/Logs/Test + destination: xcresults + - store_artifacts: + path: artifacts + destination: buildlogs diff --git a/.jazzy.yaml b/.jazzy.yaml index 2bed6d49..b6d4c00a 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.7.3 +module_version: 2.7.4 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.3/XCDYouTubeKit +github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.7.4/XCDYouTubeKit diff --git a/CHANGELOG.md b/CHANGELOG.md index 207a1c49..b71ae674 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +#### Version 2.7.4 + +* Add the ability to fetch certain age-gate videos. (#431) + #### Version 2.7.3 * Adaptation to YouTube API change. (#419, #422. #421) diff --git a/Makefile b/Makefile index 2e6783e3..cbfd6efa 100644 --- a/Makefile +++ b/Makefile @@ -22,22 +22,22 @@ test_iOS_report: check_scan fastlane scan --output_directory "${CIRCLE_TEST_REPORTS}" --output_types junit --output_files $@.xml --device "iPhone 5s" --code_coverage --xcargs "OBJROOT=build GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES" test_tvOS_report: check_scan - fastlane scan --output_directory "${CIRCLE_TEST_REPORTS}" --output_types junit --output_files $@.xml --device "Apple TV 1080p" + fastlane scan --output_directory "${CIRCLE_TEST_REPORTS}" --output_types junit --output_files $@.xml --device "Apple TV" test_macOS: check_scan - fastlane scan --configuration Release --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep MACOSX_DEPLOYMENT_TARGET=`xcrun --sdk "macosx" --show-sdk-version`" + fastlane scan --configuration Release --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep MACOSX_DEPLOYMENT_TARGET=`xcrun --sdk "macosx" --show-sdk-version`" test_iOS: check_scan - fastlane scan --configuration Release --device "iPhone 5s" --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep IPHONEOS_DEPLOYMENT_TARGET=`xcrun --sdk "iphonesimulator" --show-sdk-version`" + fastlane scan --configuration Release --device "iPhone 5s" --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep IPHONEOS_DEPLOYMENT_TARGET=`xcrun --sdk "iphonesimulator" --show-sdk-version`" test_tvOS: check_scan - fastlane scan --configuration Release --device "Apple TV 1080p" --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep TVOS_DEPLOYMENT_TARGET=`xcrun --sdk "appletvsimulator" --show-sdk-version`" + fastlane scan --configuration Release --device "Apple TV" --xcargs "RUN_CLANG_STATIC_ANALYZER=YES CLANG_STATIC_ANALYZER_MODE=Deep TVOS_DEPLOYMENT_TARGET=`xcrun --sdk "appletvsimulator" --show-sdk-version`" -test_iOS_9: check_scan - fastlane scan --device "iPhone 5s (9.0)" +test_iOS_10: check_scan + fastlane scan --device "iPhone 5s (10.3.1)" check_scan: - @fastlane scan --version > /dev/null 2>&1 || (printf "❌ Please install \e[1;30mscan\e[0m (https://github.com/fastlane/fastlane/tree/master/scan) to run unit tests: $$ [sudo] \e[1;30mgem install scan\e[0m\n" && false) + @fastlane scan --version > /dev/null 2>&1 || (printf "❌ Please install \e[1;30mfastlane scan\e[0m (https://docs.fastlane.tools/actions/scan/) to run unit tests: $$ [sudo] \e[1;30mgem install fastlane\e[0m\n" && false) check_slather: @slather version > /dev/null 2>&1 || printf "⚠️ Please install \e[1;30mslather\e[0m (https://github.com/SlatherOrg/slather) to get a code coverage report: $$ [sudo] \e[1;30mgem install slather\e[0m\n" diff --git a/Scripts/analyzer.py b/Scripts/analyzer.py index ef2bceea..e7f9ad1e 100755 --- a/Scripts/analyzer.py +++ b/Scripts/analyzer.py @@ -6,12 +6,16 @@ if not run_clang_static_analyzer[:1] in 'YyTt123456789': sys.exit(0) -analyzer_results_dir = os.path.join(os.environ['TARGET_TEMP_DIR'], 'StaticAnalyzer', os.environ['PROJECT_NAME'], os.environ['TARGET_NAME'], os.environ['CURRENT_VARIANT'], os.environ['CURRENT_ARCH']) -if not os.path.exists(analyzer_results_dir): - sys.exit("error: Static Anaylzer results not found, expected in %s" % analyzer_results_dir) +base_dir = os.path.join(os.environ['TARGET_TEMP_DIR'], 'StaticAnalyzer', os.environ['PROJECT_NAME'], os.environ['TARGET_NAME'], os.environ['CURRENT_VARIANT']) +analyzer_results_dirs = map(lambda arch : os.path.join(base_dir, arch), os.environ['ARCHS'].split(' ')) +results = [] +for analyzer_results_dir in analyzer_results_dirs: + results.extend(glob.iglob(os.path.join(analyzer_results_dir, "*.plist"))) +if len(results) == 0: + sys.exit("error: Static Anaylzer plist results not found, searched inside <%s>" % '> and <'.join(analyzer_results_dirs)) exit_code = 0 -for result in glob.iglob(os.path.join(analyzer_results_dir, "*.plist")): +for result in results: with open(result) as f: plist = plistlib.readPlist(f) for diagnostic in plist['diagnostics']: diff --git a/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj b/XCDYouTubeKit Demo/XCDYouTubeKit Demo.xcodeproj/project.pbxproj index fc883559..b46e26c5 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.7.3; + CURRENT_PROJECT_VERSION = 2.7.4; 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.7.3; + CURRENT_PROJECT_VERSION = 2.7.4; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; diff --git a/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testConnectionErrorWithDashManifest.json b/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testConnectionErrorWithDashManifest.json index a441e7b2..b42c4a86 100644 --- a/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testConnectionErrorWithDashManifest.json +++ b/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testConnectionErrorWithDashManifest.json @@ -29,7 +29,7 @@ "domain" : "NSURLErrorDomain" }, "method" : "GET", - "status" : 0, + "status" : 404, "uri" : "https:\/\/manifest.googlevideo.com\/api\/manifest\/dash\/pl\/18\/id\/60b83e2c29185db2\/fvip\/4\/ms\/au%2Conr\/mm\/31%2C26\/mv\/m\/initcwndbps\/81250\/source\/youtube\/sparams\/as%2Cei%2Chfr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cplayback_host%2Crequiressl%2Csource%2Cexpire\/mn\/sn-o097znl6%2Csn-a5meknsy\/mt\/1541595266\/ip\/107.170.239.51\/key\/yt6\/hfr\/all\/expire\/1541616988\/ipbits\/0\/as\/fmp4_audio_clear%2Cfmp4_sd_hd_clear\/itag\/0\/requiressl\/yes\/signature\/55DBE87B69362A07203FDA0794E12D8646FF861C.399D1A0D174914F0CDF87E13DE2ECFFA2BE76B95\/ei\/_ODiW6W9EMzSkgb3uLH4Cw\/playback_host\/r2---sn-o097znl6.googlevideo.com" } -] \ No newline at end of file +] diff --git a/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testGeoblockedVideo.json b/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testGeoblockedVideo.json index 6c560a8b..4a20d720 100644 --- a/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testGeoblockedVideo.json +++ b/XCDYouTubeKit Tests/Cassettes/XCDYouTubeClientTestCase/testGeoblockedVideo.json @@ -1,16 +1,36 @@ [ { - "body" : " \n \n \n \n Dedication To My Ex (Miss That) (Lyric Video) - YouTube\n \n \n\n\n\n \n
\n", + "headers" : { + "X-Content-Type-Options" : "nosniff", + "Content-Type" : "text/html; charset=utf-8", + "Server" : "YouTube Frontend Proxy", + "Strict-Transport-Security" : "max-age=31536000", + "Expires" : "Tue, 27 Apr 1971 19:44:06 EST", + "Date" : "Mon, 06 May 2019 14:31:11 GMT", + "Content-Encoding" : "br", + "X-XSS-Protection" : "0", + "Alt-Svc" : "quic=\":443\"; ma=2592000; v=\"46,44,43,39\"", + "Cache-Control" : "no-cache", + "Transfer-Encoding" : "Identity" + }, + "method" : "GET", + "status" : 200, + "uri" : "https://www.youtube.com/embed/6kLq3WMV1nU" + }, + { + "body" : " \n \n \n\n\n\n\n \n\n \n\n\n \n\n\n \n\n \n\n\n\n \n \n\n \n \nDedication To My Ex (Miss That) (Lyric Video) - YouTube \n\n \n\n \n\n \n \n\n \n \n\n \n \n \n \n\n \n\n \n \n \n\n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n
\n \n\n
\n
\n
\n
\n \n
\n
\n
\n\n
\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n
\n
\n\n
\n
\n
\n \n
\n
\n\n\n
\n
\n
\n
\n

\n Content Warning\n\n\n

\n
\n
\n

This video may be inappropriate for some users.

\n

\n \n
\n\n\n
\n
\n\n\n
\n\n
\n \n\n

Watch Queue

Queue

Watch QueueQueue
\n \n \n \n \n
\n \n\n \n\n \n\n \n
\n
The next video is starting

    \n \n\n \nLoading...\n \n

    \n
\n \n \n
\n
\n
\nWatch Queue\n
\n\n
Queue
\n\n
\n__count__/__total__\n
\n\n
\n \n
\n
\n
\n
\n \n\n
\n\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n \n
\n
\n
\n

\n YouTube Premium\n

\n\n
\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n
\n
Get YouTube without the ads.
\n\n
\n
\n
\n
\n
\n

\n \n\n \n Working...\n \n

\n\n
\n
\n\n
\n
\n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n 1 month free\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n\n \n \n\n \n \n\n \n \n \n \n \n \n\n \n\n\n \n \n \n \n \n \n\n \n \n \n \n\n \n \n \n \n \n\n\n
\n
\n \n
\n
\n
\n
\n
\n\n
\n
\n
\n

\n \n\n\n \n Dedication To My Ex (Miss That) (Lyric Video)\n \n\n

\n
\n
\n\n
\n \n \n \n \n \"LloydVEVO\"\n\n \n \n \n \n\n \n
\n LloydVEVO\n \n \n
\n \n
\n \n
\n
\n \n
\n
\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n
\n
\n
\n
\n Unsubscribe from LloydVEVO?\n
\n
\n\n
\n \n \n
\n
\n\n
\n
\n
\n
\n
\n

\n \n\n \n Working...\n \n

\n\n
\n
\n\n
\n
\n
\n
\n
\n
\n\n\n
\n\n
\n \n
\n \n
\n
\n \n
\n
\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n
\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n

\n \n\n \n Working...\n \n

\n\n
\n
\n\n
\n
\n
\n
\n
\n
\n\n\n
\n\n
\n
\n
\n \n
\n

Want to watch this again later?

\n
\n Sign in to add this video to a playlist.\n
\n Sign in\n
\n\n
\n
\n
  • \n \n \n\n
    \n

    Need to report the video?

    \n
    \n Sign in to report inappropriate content.\n
    \n Sign in\n
    \n\n
    \n
  • \n \n Add translations\n \n
1,670,220 views
\n
\n
\n
\n
\n
\n\n\n\n\n \n \n \n
\n

Like this video?

\n
\n Sign in to make your opinion count.\n
\n Sign in\n
\n\n
\n \n \n \n \n \n
\n

Don't like this video?

\n
\n Sign in to make your opinion count.\n
\n Sign in\n
\n\n
\n \n \n \n
\n
\n
\n\n\n\n
\n
\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n
\n
\n\n
\n\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n
\n\n \n
\n
\n Rating is available when the video has been rented.\n
\n\n
\n\n
\n
\n This feature is not available right now. Please try again later.\n
\n
\n\n \n
\n\n\n
\n\n\n
Published on Jun 29, 2011

Lloyd performing Dedication To My Ex (Miss That) (Lyric Video) feat. André 3000 & Lil Wayne. Buy Now! http://glnk.it/5r © 2011 Interscope Records

\n
    \n
  • \n

    \n Notice\n

    \n \n
  • \n\n
  • \n

    \n Category\n

    \n \n
  • \n\n
  • \n

    \n Song\n

    \n
      \n
    • Dedication To My Ex (Miss That) (Album Version (Edited))
    • \n
    \n
  • \n\n
  • \n

    \n Artist\n

    \n
      \n
    • Lloyd
    • \n
    \n
  • \n\n
  • \n

    \n Licensed to YouTube by\n

    \n
      \n
    • UMG (on behalf of Zone 4 Inc/Interscope); LatinAutor - PeerMusic, ARESA, PEDL, CMRRA, UMPI, ASCAP, BMG Rights Management, Warner Chappell, Abramus Digital, LatinAutor - UMPG, LatinAutor - Warner Chappell, UMPG Publishing, UBEM, BMI - Broadcast Music Inc., LatinAutor, and 9 Music Rights Societies
    • \n
    \n
  • \n\n
\n
\n
\n \n
\n\n\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n\n\n
\n
\n
\n\n\n\n
\n\n
\n \n
\n
\n
\n
\n\n
\n
\n
\n\n\n
\n\n
    \n
  • \n \n\n\n
  • \n
  • \n \n\n\n
  • \n
  • \n \n\n\n
  • \n
\nHistory \n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n\n
\n
\n \n
\n
\n
\n
\n

\n \n\n \nLoading...\n \n

\n\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n

\n \n\n \n Working...\n \n

\n\n
\n
\n\n
\n
\n
\n
\n
\n
\n\n\n
\n Sign in to add this to Watch Later\n\n
\n
\n

\nAdd to\n

\n
\n
\n

\n \n\n \n Loading playlists...\n \n

\n\n
\n
\n \n \n \n\n \n\n\n", + "headers" : { + "Content-Type" : "text/html; charset=utf-8", + "P3P" : "CP=\"This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info.\"", + "Alt-Svc" : "quic=\":443\"; ma=2592000; v=\"46,44,43,39\"", + "Set-Cookie" : "YSC=pUuzlqpWxjc; path=/; domain=.youtube.com; httponly", + "Server" : "YouTube Frontend Proxy", + "Content-Encoding" : "br", + "X-XSS-Protection" : "0", + "Expires" : "Tue, 27 Apr 1971 19:44:06 EST", + "Transfer-Encoding" : "Identity", + "Cache-Control" : "no-cache", + "Date" : "Mon, 06 May 2019 14:31:10 GMT", + "Strict-Transport-Security" : "max-age=31536000", + "X-Content-Type-Options" : "nosniff", + "X-Frame-Options" : "SAMEORIGIN" + }, + "method" : "GET", + "status" : 200, + "uri" : "https://www.youtube.com/watch?bpctr=9999999999&has_verified=1&hl=en&v=6kLq3WMV1nU" + } +] \ No newline at end of file diff --git a/XCDYouTubeKit Tests/Cassettes/XCDYouTubeProtectedVideosTestCase/testAgeRestrictedVideoThatRequiresCookiesWithoutCookies.json b/XCDYouTubeKit Tests/Cassettes/XCDYouTubeProtectedVideosTestCase/testAgeRestrictedVideoThatRequiresCookiesWithoutCookies.json index df50fb15..144b60e9 100644 --- a/XCDYouTubeKit Tests/Cassettes/XCDYouTubeProtectedVideosTestCase/testAgeRestrictedVideoThatRequiresCookiesWithoutCookies.json +++ b/XCDYouTubeKit Tests/Cassettes/XCDYouTubeProtectedVideosTestCase/testAgeRestrictedVideoThatRequiresCookiesWithoutCookies.json @@ -1,16 +1,16 @@ [ { - "body" : " \n