From baebe7bc20c95fed7c0cc143889281d98cfc15f4 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 5398a1c1..decbde74 100644 --- a/XCDYouTubeKit/XCDYouTubeVideoOperation.m +++ b/XCDYouTubeKit/XCDYouTubeVideoOperation.m @@ -119,7 +119,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]; @@ -129,6 +129,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]; @@ -305,8 +306,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]; }