I am new to this iPhone development.Currently I am facing a problem to validate the YouTube videos . I am getting the YouTube URL from SOL server.I just want to check whether that video exists in YouTube server.I came to know that this can be check through YouTube video id .But i could not find any sample code for this.Can any one suggest me a better method or give a sample code?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Angular Material Stepper causes mat-formfield to v
- Could I create “Call” button in HTML 5 IPhone appl
- Why doesn't Django enforce my unique_together
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
Youtube has data api
For example you can do something like this:
1) You have full url to a video in format http://www.youtube.com/watch?v=uCYTpCYLqbs Its id is
uCYTpCYLqbs
2) Make request to
http://gdata.youtube.com/feeds/api/videos/<VIDEO ID>?v=2&alt=json
. In our case it is:http://gdata.youtube.com/feeds/api/videos/uCYTpCYLqbs?v=2&alt=json
3) If the video is valid you'll receive some usefull information about it. Otherwise you'll get an error.
Code can be like this:
You can use error param in
stringWithContentsOfURL:encoding:error:
to handle error more accurate. Or use NSURLRequest. Anyway the main idea would be the same.