0xced / XCDYouTubeKit

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

This video contains content from VEVO. It is restricted from playback on certain sites or applications. Watch on YouTube #309

Closed mitulmarsonia closed 6 years ago

mitulmarsonia commented 7 years ago

video id : oyEuk8j8imI I have try this #297 solution but its not work for me. response :- Domain: XCDYouTubeVideoErrorDomain Code: 150 User Info: { AllowedCountries = "{(\n \"Macau (China)\",\n Hungary,\n Vietnam,\n \"New Caledonia\",\n Burundi,\n Andorra,\n \"Pitcairn Islands\",\n Guinea,\n \"Norfolk Island\",\n Togo,\n Eritrea,\n Zambia,\n China,\n Syria,\n Mongolia,\n Thailand,\n Netherlands,\n \"French Guiana\",\n India,\n Sudan,\n Nicaragua,\n Tanzania,\n Algeria,\n Grenada,\n Venezuela,\n \"Dominican Republic\",\n Turkey,\n \"New Zealand\",\n Serbia,\n Japan,\n Monaco,\n Finland,\n Paraguay,\n Lithuania,\n Suriname,\n Dominica,\n Mauritania,\n Armenia,\n Panama,\n \"St. Martin\",\n Guernsey,\n Cambodia,\n \"Western Sahara\",\n Azerbaijan,\n Gabon,\n Macedonia,\n Tonga,\n Bhutan,\n Lebanon,\n \"Svalbard & Jan Mayen\",\n \"Falkland Islands\",\n Montserrat,\n \"Cura\U00e7ao\",\n \"St. Helena\",\n Peru,\n \"Isle of Man\",\n \"Congo - Kinshasa\",\n Liberia,\n Oman,\n Ethiopia,\n Vanuatu,\n Romania,\n Nepal,\n Norway,\n Niger,\n \"South Sudan\",\n \"So. Georgia & So. Sandwich Isl.\",\n Turkmenistan,\n Germany,\n Aruba,\n Comoros,\n \"French Polynesia\",\n Belgium,\n Somalia,\n \"U.S. Outlying Islands\",\n \"American Samoa\",\n Albania,\n \"Sint Maarten\",\n \"Myanmar (Burma)\",\n Anguilla,\n Botswana,\n \"Faroe Islands\",\n \"Solomon Islands\",\n Cuba,\n Guyana,\n Nauru,\n \"North Korea\",\n \"El Salvador\",\n Honduras,\n Moldova,\n Taiwan,\n \"Equatorial Guinea\",\n Chile,\n Uzbekistan,\n Bermuda,\n \"British Indian Ocean Territory\",\n Liechtenstein,\n Argentina,\n Libya,\n Tajikistan,\n \"Costa Rica\",\n Canada,\n Italy,\n \"Congo - Brazzaville\",\n Guam,\n Qatar,\n Mexico,\n \"R\U00e9union\",\n Malaysia,\n Cameroon,\n Slovakia,\n \"Cayman Islands\",\n \"\U00c5land Islands\",\n Iran,\n Micronesia,\n \"San Marino\",\n Poland,\n Maldives,\n Cyprus,\n Israel,\n Uruguay,\n Palau,\n Belarus,\n Bangladesh,\n Nigeria,\n Russia,\n Gibraltar,\n \"Northern Mariana Islands\",\n Ireland,\n Croatia,\n \"Timor-Leste\",\n Brazil,\n Barbados,\n Colombia,\n \"Cook Islands\",\n Portugal,\n \"Christmas Island\",\n Bahamas,\n Pakistan,\n Bolivia,\n \"Heard & McDonald Islands\",\n Mali,\n Ghana,\n \"Antigua & Barbuda\",\n \"Sri Lanka\",\n Iraq,\n \"South Africa\",\n Kuwait,\n \"Puerto Rico\",\n Gambia,\n \"Cape Verde\",\n Latvia,\n Fiji,\n \"Palestinian Territories\",\n Martinique,\n \"St. Lucia\",\n Mayotte,\n Iceland,\n \"Czech Republic\",\n \"British Virgin Islands\",\n Switzerland,\n Singapore,\n \"Guinea-Bissau\",\n Austria,\n Namibia,\n Mauritius,\n Benin,\n Tokelau,\n Afghanistan,\n \"St. Kitts & Nevis\",\n Swaziland,\n Bahrain,\n \"United States\",\n Chad,\n Brunei,\n Angola,\n \"Papua New Guinea\",\n \"United Arab Emirates\",\n Kazakhstan,\n Spain,\n Guatemala,\n \"Cocos (Keeling) Islands\",\n \"U.S. Virgin Islands\",\n Ukraine,\n \"French Southern Territories\",\n Philippines,\n \"S\U00e3o Tom\U00e9 & Pr\U00edncipe\",\n \"South Korea\",\n Djibouti,\n Jamaica,\n Slovenia,\n Samoa,\n Luxembourg,\n Tuvalu,\n Senegal,\n \"Wallis & Futuna\",\n Estonia,\n Seychelles,\n \"Saudi Arabia\",\n Morocco,\n Greece,\n Georgia,\n Kenya,\n Tunisia,\n \"Hong Kong (China)\",\n Malta,\n \"St. Vincent & Grenadines\",\n \"Vatican City\",\n \"Marshall Islands\",\n Jersey,\n \"Turks & Caicos Islands\",\n \"St. Barth\U00e9lemy\",\n Laos,\n Ecuador,\n Yemen,\n Belize,\n Malawi,\n Antarctica,\n Sweden,\n Greenland,\n \"Bosnia & Herzegovina\",\n Jordan,\n Zimbabwe,\n \"Bouvet Island\",\n France,\n \"Trinidad & Tobago\",\n Mozambique,\n Egypt,\n \"United Kingdom\",\n Lesotho,\n Australia,\n Uganda,\n Kyrgyzstan,\n Denmark,\n \"Central African Republic\",\n \"Sierra Leone\",\n Montenegro,\n Kiribati,\n \"Burkina Faso\",\n Niue,\n Guadeloupe,\n Indonesia,\n Madagascar,\n \"C\U00f4te d\U2019Ivoire\",\n \"St. Pierre & Miquelon\",\n Rwanda,\n Haiti,\n Bulgaria,\n \"Caribbean Netherlands\"\n)}"; NSLocalizedDescription = "This video contains content from VEVO. It is restricted from playback on certain sites or applications. Watch on YouTube"; NSURL = "https://www.youtube.com/get_video_info?el=embedded&hl=en-US&ps=default&video_id=PfGaX8G0f2E"; }

chunholi commented 7 years ago

Almost same here but with this error NSLocalizedDescription = "This video contains content from WMG. It is restricted from playback on certain sites or applications. Watch on YouTube"; NSURL = "https://www.youtube.com/get_video_info?el=embedded&hl=en&ps=default&video_id=amYXDAy1nn8"; I tried 2.5.4 but still the same.

0xced commented 7 years ago

From which country are you trying to play the video? Both are playing fine for me. I’m watching from Switzerland, which is a country listed in the AllowedCountries.

chunholi commented 7 years ago

I am in hong kong, and i checked that is in the country list, thanks

0xced commented 7 years ago

Can you watch it on the YouTube website?

chunholi commented 7 years ago

Yes, also it works on ios youtube app, and android version of my app.

mitulmarsonia commented 7 years ago

I'm in India. and i also checked in the country list. India is available in AllowedCountries.

mitulmarsonia commented 7 years ago

@0xced Can you please help me out.

k06a commented 7 years ago

@chunholi @mitulmarsonia HTTP header "Referer" should make youtube think you're watching video right on YouTube website. This PR should fix your issue: https://github.com/0xced/XCDYouTubeKit/issues/315

Until it's merged you can try it out:

pod 'XCDYouTubeKit', :git => 'https://github.com/ML-Works/XCDYouTubeKit.git', :branch => 'feature/referer'
chunholi commented 7 years ago

The fix really works! Thanks so much!

frakman1 commented 7 years ago

@k06a I tried adding your one-line fix directly to my code but I still get this error: Video operation finished with error: This video contains content from VEVO. It is restricted from playback on certain sites or applications. Watch on YouTube Fails when attempting to watch this video I am using version 2.3.2 Any ideas on how to proceed?

k06a commented 7 years ago

@frakman1 just checked this video from my custom app, it is playing fine:

Try to link pod like this:

pod 'XCDYouTubeKit', :git => 'https://github.com/ML-Works/XCDYouTubeKit.git', :branch => 'feature/referer'
frakman1 commented 7 years ago

@k06a Thanks for writing back. It has to do with the fact that I was starting from 2.3.2 because that one line change didn't fix it. When I manually ported over all the changes of the latest current code from github, I finally got it to work. I can't use pod updates because I foolishly made some local changes to one of the files that I have to preserve (oops)

k06a commented 7 years ago

@frakman1 you should fork this repo, commit your changes to separate branch, link it to your project like I show you before and open PR for your changes to be merged in original repo :)

frakman1 commented 7 years ago

"like I show you before" ? When ? Actually, my changes are unrelated to the YouTube project and part of my own app. I should have sub-classed but I didn't know how to do that. Thanks for your help though!

k06a commented 7 years ago

@frakman1 link your fork this way:

pod 'XCDYouTubeKit', :git => 'https://github.com/ML-Works/XCDYouTubeKit.git', :branch => 'feature/referer'
shaoyj commented 6 years ago

Add parameters to the head origin:https://www.youtube.com referer:https://www.youtube.com/watch?v=nhNqbe6QENY Perfect solution.

ChristianDeckert commented 6 years ago

Experiencing the error 150 issue with almost every popular music video ...

SoneeJohn commented 6 years ago

@ChristianDeckert Which version of the library you're running? Also, can you give me an example video?

inquis commented 6 years ago

I have the same problem as @ChristianDeckert example video ID: uF9YayOgjRg