1

How can I download videos from you-tube and save in my app folder. I have videoID, but don't have working code. I found this link but the code from this link is not working for me.

Save Youtube video to iPhone in the app

If any one have any working code please share it with me thanks.

Community
  • 1
  • 1
Nisar Ahmad
  • 1,647
  • 2
  • 9
  • 28

1 Answers1

1

Set your youtube url

- (void)downloadMultiAFN:(NSString *)userIDFrom messageId:(NSString *)msgId message:(NSString *)message url:(NSString *)url contact:(NSString *) contact nickName:(NSString *)nickName  {
    imageUrlPathForSharingMessgeId=msgId;

    NSURL *URL = [NSURL URLWithString:url];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    AFHTTPRequestOperation *downloadRequest = [[AFHTTPRequestOperation alloc] initWithRequest:request];
    [downloadRequest setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {

        NSData *data = [[NSData alloc] initWithData:responseObject];

// you can save video or image with avi or png  
      //  [[DBManagernew getSharedInstance] saveDataUploadImage:msgId isRead:NO isSend:YES isReceipt:NO image:data];
      //  imageIsSelected=NO;
  // [self fetchAllMessage];



    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"file downloading error : %@", [error localizedDescription]);
    }];

    [downloadRequest start];


}
raj yadav
  • 115
  • 14