0

显示这种提要的最简单方法是什么?我听说你可以用 Yahoo 管道做到这一点,但 Twitter 是否直接支持这一点?

谢谢!

4

1 回答 1

0

http://search.twitter.com/search?q=%23weloveyouss501

有你的哈希标签...见右边有这个查询的 RSS 提要:

http://search.twitter.com/search.atom?q=%23weloveyouss501

太棒了 - 现在您只需要 TouchXML 和这个功能:

-(void)getRSSFeed:(NSString *)XMLString {

    blogEntries = [[[NSMutableArray alloc] init] autorelease]; // blogEntries in header

    NSError *theError;
    CXMLDocument *rssParser = [[[CXMLDocument alloc] initWithXMLString:XMLString options:0 error:&theError] autorelease];

    if(theError){
        NSLog(@"An error");
    }

    NSArray *resultNodes = NULL;
    resultNodes = [rssParser nodesForXPath:@"//item" error:nil];

    for (CXMLElement *resultElement in resultNodes) {
        NSMutableDictionary *blogItem = [[NSMutableDictionary alloc] init];

        int counter;
        for(counter = 0; counter < [resultElement childCount]; counter++) {

            [blogItem setObject:[[resultElement childAtIndex:counter] stringValue] forKey:[[resultElement childAtIndex:counter] name]];
        }
        [blogEntries addObject:[blogItem copy]]; // blog entries set in header
    }

}

如果您输出blogEntries,您将看到所有条目。:) 现在你可以轻松搞定它们了。:)

于 2010-09-10T14:18:02.670 回答