0
我正在使用hpple库解析HTML文档。我想为视频网址提取.mp4链接和图像链接。 HTML标记看起来是这样的:
<meta property="og:video" content="http://instagram.fbom1-1.fna.fbcdn.net/t50.2886-16/17686957_372561729804133_1618562720464896000_n.mp4">
代码:
NSURL *instagramUrl = [NSURL URLWithString:@"https://www.instagram.com/p/BSdePkEFfO-/?tagged=video&hl=en"];
NSData *htmlData = [NSData dataWithContentsOfURL: instagramUrl];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:htmlData];
NSArray *elements = [xpathParser searchWithXPathQuery:@"//div[@id='preview']"];
TFHppleElement *element = [elements objectAtIndex:0];
NSString *string = [element content];
NSLog(@"%@", string);
我越来越TFHppleElement空always.I没有这想法的人,请帮助。
谢谢!
以下链接检查,可能对你有帮助的http://计算器。 com/a/12185329/5184217 –
谢谢你,@RajeshDharani你给了我一个想法如何做到这一点。我的问题解决了。非常感谢!!! – sarita
如果您发现此答案正确,请检查此答案是否正确。 –