From 532e3eaae5ffad328eadda3c8c674e817c4f06a7 Mon Sep 17 00:00:00 2001 From: Paresh Mittal Date: Fri, 28 May 2021 15:57:00 +0530 Subject: [PATCH] Failed to decode response error Solution - https://github.com/0xced/XCDYouTubeKit/issues/531 --- XCDYouTubeKit/XCDYouTubeVideoOperation.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/XCDYouTubeKit/XCDYouTubeVideoOperation.m b/XCDYouTubeKit/XCDYouTubeVideoOperation.m index be4ce9ee..1e3fe16c 100644 --- a/XCDYouTubeKit/XCDYouTubeVideoOperation.m +++ b/XCDYouTubeKit/XCDYouTubeVideoOperation.m @@ -149,7 +149,7 @@ - (void) startNextRequest NSString *eventLabel = [self.eventLabels objectAtIndex:0]; [self.eventLabels removeObjectAtIndex:0]; - NSDictionary *query = @{ @"video_id": self.videoIdentifier, @"hl": self.languageIdentifier, @"el": eventLabel, @"ps": @"default" }; + NSDictionary *query = @{ @"video_id": self.videoIdentifier, @"hl": self.languageIdentifier, @"el": eventLabel, @"ps": @"default", @"html5" : @1 }; NSString *queryString = XCDQueryStringWithDictionary(query); NSURL *videoInfoURL = [NSURL URLWithString:[@"https://www.youtube.com/get_video_info?" stringByAppendingString:queryString]]; [self startRequestWithURL:videoInfoURL type:XCDYouTubeRequestTypeGetVideoInfo]; @@ -159,6 +159,7 @@ - (void) startNextRequest - (void) startWatchPageRequest { NSDictionary *query = @{ @"v": self.videoIdentifier, @"hl": self.languageIdentifier, @"has_verified": @YES, @"bpctr": @9999999999 }; + NSString *queryString = XCDQueryStringWithDictionary(query); NSURL *webpageURL = [NSURL URLWithString:[@"https://www.youtube.com/watch?" stringByAppendingString:queryString]]; [self startRequestWithURL:webpageURL type:XCDYouTubeRequestTypeWatchPage]; @@ -358,8 +359,8 @@ - (void) handleJavaScriptPlayerWithScript:(NSString *)script { NSString *eurl = [@"https://youtube.googleapis.com/v/" stringByAppendingString:self.videoIdentifier]; NSString *sts = self.embedWebpage.sts ?: self.webpage.sts ?: @""; - NSDictionary *query = @{ @"video_id": self.videoIdentifier, @"hl": self.languageIdentifier, @"eurl": eurl, @"sts": sts}; - NSString *queryString = XCDQueryStringWithDictionary(query); + NSDictionary *query = @{ @"video_id": self.videoIdentifier, @"hl": self.languageIdentifier, @"eurl": eurl, @"sts": sts, @"html5" : @1 }; + NSString *queryString = XCDQueryStringWithDictionary(query); NSURL *videoInfoURL = [NSURL URLWithString:[@"https://www.youtube.com/get_video_info?" stringByAppendingString:queryString]]; [self startRequestWithURL:videoInfoURL type:XCDYouTubeRequestTypeGetVideoInfo]; }