当前位置: 首页>>代码示例>>PHP>>正文


PHP Crawler::fetchInstanceUserReplies方法代码示例

本文整理汇总了PHP中Crawler::fetchInstanceUserReplies方法的典型用法代码示例。如果您正苦于以下问题:PHP Crawler::fetchInstanceUserReplies方法的具体用法?PHP Crawler::fetchInstanceUserReplies怎么用?PHP Crawler::fetchInstanceUserReplies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crawler的用法示例。


在下文中一共展示了Crawler::fetchInstanceUserReplies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: OwnerInstanceDAO

$oid = new OwnerInstanceDAO($db, $logger);
$lurlapi = new LongUrlAPIAccessor($TWITALYTIC_CFG['app_title']);
$flickrapi = new FlickrAPIAccessor($TWITALYTIC_CFG['flickr_api_key']);
$instances = $id->getAllInstancesStalestFirst();
foreach ($instances as $i) {
    $logger->setUsername($i->twitter_username);
    $tokens = $oid->getOAuthTokens($i->id);
    $api = new CrawlerTwitterAPIAccessorOAuth($tokens['oauth_access_token'], $tokens['oauth_access_token_secret'], $TWITALYTIC_CFG['oauth_consumer_key'], $TWITALYTIC_CFG['oauth_consumer_secret'], $i, $TWITALYTIC_CFG['archive_limit']);
    $crawler = new Crawler($i, $logger, $api, $db);
    $cfg = new Config($i->twitter_username, $i->twitter_user_id);
    $api->init($logger);
    if ($api->available_api_calls_for_crawler > 0) {
        $id->updateLastRun($i->id);
        $crawler->fetchInstanceUserInfo();
        $crawler->fetchInstanceUserTweets($lurlapi, $flickrapi);
        $crawler->fetchInstanceUserReplies($lurlapi, $flickrapi);
        $crawler->fetchInstanceUserFriends();
        $crawler->fetchInstanceUserFollowers();
        $crawler->fetchStrayRepliedToTweets($lurlapi, $flickrapi);
        $crawler->fetchUnloadedFollowerDetails();
        $crawler->fetchFriendTweetsAndFriends($lurlapi, $flickrapi);
        // TODO: Get direct messages
        // TODO: Gather favorites data
        $crawler->cleanUpFollows();
        // Save instance
        $id->save($crawler->instance, $crawler->owner_object->tweet_count, $logger, $api);
    }
}
$logger->close();
# Close logging
if (isset($conn)) {
开发者ID:karbassi,项目名称:twitalytic,代码行数:31,代码来源:crawl.php

示例2: InstanceDAO

$conn = $db->getConnection();
$id = new InstanceDAO();
$oid = new OwnerInstanceDAO();
$instances = $id->getAllInstancesStalestFirst();
foreach ($instances as $i) {
    $crawler = new Crawler($i);
    $cfg = new Config($i->twitter_username, $i->twitter_user_id);
    $logger = new Logger($i->twitter_username);
    $tokens = $oid->getOAuthTokens($i->id);
    $api = new CrawlerTwitterAPIAccessorOAuth($tokens['oauth_access_token'], $tokens['oauth_access_token_secret'], $cfg, $i);
    $api->init($logger);
    if ($api->available_api_calls_for_crawler > 0) {
        $id->updateLastRun($i->id);
        $crawler->fetchInstanceUserInfo($cfg, $api, $logger);
        $crawler->fetchInstanceUserTweets($cfg, $api, $logger);
        $crawler->fetchInstanceUserReplies($cfg, $api, $logger);
        $crawler->fetchInstanceUserFriends($cfg, $api, $logger);
        $crawler->fetchInstanceUserFollowers($cfg, $api, $logger);
        $crawler->fetchStrayRepliedToTweets($cfg, $api, $logger);
        $crawler->fetchUnloadedFollowerDetails($cfg, $api, $logger);
        $crawler->fetchFriendTweetsAndFriends($cfg, $api, $logger);
        // TODO: Get direct messages
        // TODO: Gather favorites data
        $crawler->cleanUpFollows($cfg, $api, $logger);
        // Save instance
        $id->save($crawler->instance, $crawler->owner_object->tweet_count, $logger, $api);
    }
    $logger->close();
    # Close logging
}
if (isset($conn)) {
开发者ID:ntulip,项目名称:twitalytic,代码行数:31,代码来源:crawl.php


注:本文中的Crawler::fetchInstanceUserReplies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。