function boostYtAccount($uid) { $query = "Select user_id, user_password from users where id={$uid};"; $result = $this->getDBConnection()->queryDB($query); $row = $result->fetch_assoc(); $userName = $row['user_id']; $password = $row['user_password']; //echo("Username: $userName | Password: $password<br>"); $httpClient = $this->getHttpClient($userName, $password); $yt = new Zend_Gdata_YouTube($httpClient, $this->applicationId, $this->clientId, $this->developerKey); $yt->setMajorProtocolVersion(2); $cc = new CommentCreator(); echo "<font color='green'>Acting as user {$userName}</font><br>"; // For all other users foreach ($this->ytAccounts as $otherUserName => $password) { echo "<font color='orange'>Parsing video feed for user {$otherUserName}</font><br>"; $videoFeed = $yt->getuserUploads($otherUserName); $feedCount = 0; do { $feedCount++; foreach ($videoFeed as $videoEntry) { $videoURL = $videoEntry->getVideoWatchPageUrl(); $videoID = $videoEntry->getVideoId(); //$query = "Select id, boosted from post where postURL='".$videoURL."'"; $query = "Select id from boosted where video_id='" . $videoID . "' AND user_id={$uid}"; //echo($query . "<br>"); $result = $this->getDBConnection()->queryDB($query); $resultCount = $result->num_rows; $boosted = true; if ($resultCount == 0) { $boosted = false; } // If videoEntry has not already been boosted if (!$boosted) { echo "<font color='purple'><b>Boosting video " . $videoEntry->getVideoTitle() . "</b><br>"; // Add a 5 star rating to videos if ($this->add5StarRating($yt, $videoEntry)) { echo "Adding 5 stars to video.<br>"; } else { exit(0); } // Add a comment to other users videos if ($this->addCommentToVideo($yt, $videoEntry, $cc->getComment())) { echo "Adding comments to video.<br>"; } else { exit(0); } // Add one of your videos to a response // TODO: Maybe in the future if the respones video can be approaved automatically //if($this->addVideoResponse($yt, $videoEntry, $videoResponseEntry)){ // echo("Adding video response to video.<br>"); //}else{ //exit(0); //} echo "</font>"; $query = "Insert Ignore INTO boosted (user_id, video_id) Values ({$uid},'{$videoID}')"; $this->getDBConnection()->queryDB($query); echo "<b><a href='{$videoURL}'>{$videoURL}</a> NOW boosted!!!</b><br>"; sleep(rand(10, 30)); } else { echo "<u><a href='{$videoURL}'>{$videoURL}</a> already boosted.</u><br>"; } } try { $videoFeed = $videoFeed->getNextFeed(); //var_dump($videoFeed); //echo("<br><br><br>"); } catch (Exception $e) { //echo("NextFeedError: " . $e -> getMessage() . "<br>"); $videoFeed = null; //echo("<font color='blue'>User $otherUserName feed count: $feedCount</font><br>"); } } while (isset($videoFeed)); // Subscribe to other users yt accounts if ($this->subscribeToUserChannel($yt, $otherUserName)) { echo "<font color='red'>Subscribbing to users channel.</font><br>"; } else { continue; } } }
function __construct() { self::$positiveAdjectives = array("Amazing", "Awesome", "Blithesome", "Excellent", "Fabulous", "Fantastic", "Favorable", "Fortuitous", "Great", "Incredible", "Ineffable", "Mirthful", "Outstanding", "Perfect", "Propitious", "Remarkable", "Smart", "Spectacular", "Splendid", "Stellar", "Stupendous", "Super", "Ultimate", "Unbelievable", "Wondrous"); $this->commentTemplate = array("|A| video!!!", "That was a |a| video.", "Glad I watched your video. It was |a|!!!", "That was an |a1| video. Simply |a2|!!!", "That was an |a1| video. Simply |a1|!!!", "Thank you for posting a |a| video like this. It was exactly what I needed.", "I purchased this |a| product after watching this video. Thanks for sharing!", '#|A|'); //$this->spinner = new SpinnerChief ( "b8ed07f9276342e7b", "frostbyte07", "Neeuq011", 443 ); }