當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crawler::fetchFriendTweetsAndFriends方法代碼示例

本文整理匯總了PHP中Crawler::fetchFriendTweetsAndFriends方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crawler::fetchFriendTweetsAndFriends方法的具體用法?PHP Crawler::fetchFriendTweetsAndFriends怎麽用?PHP Crawler::fetchFriendTweetsAndFriends使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crawler的用法示例。


在下文中一共展示了Crawler::fetchFriendTweetsAndFriends方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: CrawlerTwitterAPIAccessorOAuth

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'], $THINKTANK_CFG['oauth_consumer_key'], $THINKTANK_CFG['oauth_consumer_secret'], $i, $THINKTANK_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->fetchInstanceUserRetweetsByMe($lurlapi, $flickrapi);
        $crawler->fetchInstanceUserMentions($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)) {
    $db->closeConnection($conn);
}
// Clean up
開發者ID:nickthornley,項目名稱:thinktank,代碼行數:31,代碼來源:crawl.php

示例2: Crawler

$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)) {
    $db->closeConnection($conn);
}
// Clean up
開發者ID:ntulip,項目名稱:twitalytic,代碼行數:31,代碼來源:crawl.php


注:本文中的Crawler::fetchFriendTweetsAndFriends方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。