Objective c 如何提取;meta[content$=.mp4]/content";从ios中的html文档?

Objective c 如何提取;meta[content$=.mp4]/content";从ios中的html文档?,objective-c,ios9,tfhpple,Objective C,Ios9,Tfhpple,我正在使用hpple库解析HTML文档。我想提取视频URL的.mp4链接和图像链接。Html标记如下所示: <meta property="og:video" content="http://instagram.fbom1-1.fna.fbcdn.net/t50.2886-16/17686957_372561729804133_1618562720464896000_n.mp4"> 我总是让TFHPPLElement为空。我不知道这个人,请帮助 谢谢大家! //获取.jpg链接

我正在使用hpple库解析HTML文档。我想提取视频URL的.mp4链接和图像链接。Html标记如下所示:

<meta property="og:video" content="http://instagram.fbom1-1.fna.fbcdn.net/t50.2886-16/17686957_372561729804133_1618562720464896000_n.mp4">
我总是让TFHPPLElement为空。我不知道这个人,请帮助

谢谢大家!

//获取.jpg链接

 NSURL *cUrl = [NSURL URLWithString:url1];
    NSData *cHtmlData = [NSData dataWithContentsOfURL:cUrl];
    TFHpple *cParser = [TFHpple hppleWithHTMLData:cHtmlData];
    NSArray *elements = [cParser searchWithXPathQuery:@"//meta[@property='og:image']"];
    TFHppleElement *element = [elements objectAtIndex:0];
    NSDictionary *attributes = [element attributes];
    NSString *content1 = [attributes objectForKey:@"content"];

    NSLog(@"save instagram image content1=%@",content1);
//要获取.mp4链接,请使用下面的xPathQuery

NSArray *elements = [cParser searchWithXPathQuery:@"//meta[@property='og:video']"];

查看下面的链接可能会对您有所帮助谢谢,@RajeshDharani您给了我一个方法。我的问题解决了。谢谢!!!如果您发现这个答案是正确的,请检查这个答案是否正确。
NSArray *elements = [cParser searchWithXPathQuery:@"//meta[@property='og:video']"];