How do i grab the URL_TO_GRAB, with Hpple/Xpath for iPhone? Do i need to use some regex?
<div clas开发者_运维技巧s="content">
<a href="URL_TO_GRAB"> Link </a>
</div>
Thanks a bunch.
You should be able to get it like this,
NSArray * elements = [doc search:@"//a"];
for ( TFHppleElement * element in elements ) {
NSString * URLString = [[element attributes] objectForKey:@"href"];
NSLog(@"%@", URLString);
}
This matches all anchor links and prints their urls.
精彩评论