Search code examples
iosxcodeyoutubeuiwebview

Need to process a request to youtube inside an iOS app


If I take a browser and type http://www.youtube.com/get_video_info?video_id=$id&el=embedded&ps=default&eurl=&gl=US&hl=en into it, I get a bunch of text describing video with ID $id in a form of a file, that gets downloaded by a browser. The file contains a large string that is unique every time the request is performed.

Now, I need to gain access to that giant string inside iOS app.

Could you please tell me where to start digging? UIWebViews? Or maybe there's a simple solution?

Thanks in advance.


Solution

  • NSURL *url = [NSURL URLWithString:@"https://www.youtube.com/get_video_info?video_id=$id&el=embedded&ps=default&eurl=&gl=US&hl=en"];
    NSData *data = [NSData dataWithContentsOfURL:url];
    NSString *idString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];