0xced / XCDYouTubeKit

YouTube video player for iOS, tvOS and macOS
MIT License
2.92k stars 626 forks source link

Fixes error: Correctly sets YouTube consent cookie #524

Open alexeichhorn opened 3 years ago

alexeichhorn commented 3 years ago

Hey, Great work with your repo. I've seen that YouTube made some changes recently that make XCDYouTubeKit fail in many regions. The issue was "discussed" in #523. I implemented the same solution as in youtube-dl commit 14f29f. It basically has to set a "consent-cookie" so YouTube sees you agree with their terms and conditions, cookie rules or whatever.

Would be happy to hear your feedback

Praveen-Balpande commented 3 years ago

@ekincelik Still it is not working with some urls and giving me error with reason string "Video unavailable". Please check it.

Domain: XCDYouTubeVideoErrorDomain Code: -2

Below Url is not working https://www.youtube.com/watch?v=J6R4u8jSkh4

alexeichhorn commented 3 years ago

@ekincelik Still it is not working with some urls and giving me error with reason string "Video unavailable". Please check it.

Domain: XCDYouTubeVideoErrorDomain Code: -2

Below Url is not working https://www.youtube.com/watch?v=J6R4u8jSkh4

Works for me with my pull request

niklaskorz commented 3 years ago

Works, thanks!

Praveen-Balpande commented 3 years ago

I had downloaded the code from alexeichhorn:fix/youtube-consent branch and added the required XCDYoutubeKit folder into project, because there is no new pod version available for this fix.

I run the project on real device and observed that https://www.youtube.com/watch?v=J6R4u8jSkh4 url gives me same error video unavailable.

Am I doing anything wrong here, how it’s working for u and not for me. Please suggest we depends on this lib and in a release phase. Please advise.

alexeichhorn commented 3 years ago

I tested your video using the demo application in the repository, which worked, and used SwiftPM to integrate the framework in my application where I haven't tested your video, but a lot of others. There's a chance this problem is region based, so maybe try to use a VPN to test some other regions. I myself tested it in Switzerland.

ekincelik commented 3 years ago

hi @Praveen-Balpande I used alexeichhorn:fix/youtube-consent branch too. Your video is working for me. You can check response in handleConnectionSuccessWithData method on XCDYouTubeVideoOperation.m class in order to understand what the problem is.

jyotiglocalview commented 3 years ago

Hi everyone,

I am getting this error while playing video id "E_lByLdKeKY"

2021-05-13 16:39:53.974689+0530 Quizzwizz[1362:383440] [XCDYouTubeKit] Failed to decode response from https://www.youtube.com/get_video_info?el=embedded&hl=en&ps=default&video_id=E_lByLdKeKY (response.textEncodingName = utf-8, data.length = 0) 2021-05-13 16:39:53.975118+0530 Quizzwizz[1362:383440] [XCDYouTubeKit] Video operation finished with error: The operation couldn’t be completed. (XCDYouTubeVideoErrorDomain error -3.) Domain: XCDYouTubeVideoErrorDomain Code: -3 User Info: { } Couldn't get the video from video id

please note the video works on simulator but giving error on device. please help as we are about to release our app tomorrow.

jsawko commented 3 years ago

It works for me, thanks a lot Jarek

jyotiglocalview commented 3 years ago

It works for me, thanks a lot Jarek

please help me also...in my app most of the videos are not getting played..:(

jsawko commented 3 years ago

It works for me, thanks a lot Jarek

please help me also...in my app most of the videos are not getting played..:(

Hi I have added new lines from https://github.com/0xced/XCDYouTubeKit/pull/524/commits/893401b5dcfefa300e324bbe93af6ab2be49e384

to the file: XCDYouTubeKit/XCDYouTubeVideoOperation.m

Hope that helps Best Jarek

sherwinzadeh commented 3 years ago

Can you add the fix from other pull-requests: NSDictionary *query = @{ @"video_id": self.videoIdentifier, @"hl": self.languageIdentifier, @"el": eventLabel, @"ps": @"default", @"html5" : @"1" };

alexeichhorn commented 3 years ago

@sherwinzadeh I've merged both pull requests in the master branch of my fork. I use it myself in SwiftPM for my own project.

jsawko commented 3 years ago

@sherwinzadeh I've merged both pull requests in the master branch of my fork. I use it myself in SwiftPM for my own project.

Hi, can you please write what is the correct pod file entry for your fork?