Skip to content

Commit

Permalink
Support for 280-character tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
texttheater committed Mar 31, 2018
1 parent db2c110 commit 44c462e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inc/class.twitterapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TwitterApi {
public $dbMap = array(
"id_str" => "tweetid",
"created_at" => "time",
"full_text" => "text",
"text" => "text",
"source" => "source",
"coordinates" => "coordinates",
Expand Down Expand Up @@ -168,4 +169,4 @@ public function insertQuery($t){
$type = ($t['text'][0] == "@") ? 1 : (preg_match("/RT @\w+/", $t['text']) ? 2 : 0);
return "INSERT IGNORE INTO `".DTP."tweets` (`userid`, `tweetid`, `type`, `time`, `text`, `source`, `extra`, `coordinates`, `geo`, `place`, `contributors`) VALUES ('" . $db->s($t['userid']) . "', '" . $db->s($t['tweetid']) . "', '" . $db->s($type) . "', '" . $db->s($t['time']) . "', '" . $db->s($this->entityDecode($t['text'])) . "', '" . $db->s($t['source']) . "', '" . $db->s(serialize($t['extra'])) . "', '" . $db->s(serialize($t['coordinates'])) . "', '" . $db->s(serialize($t['geo'])) . "', '" . $db->s(serialize($t['place'])) . "', '" . $db->s(serialize($t['contributors'])) . "');";
}
}
}
2 changes: 2 additions & 0 deletions maintenance/loadtweets.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ function importTweets($p){
$params['max_id'] = $maxID;
}

$params['tweet_mode'] = 'extended';

$data = $twitterApi->query('statuses/user_timeline', $params);
// Drop out on connection error
if(is_array($data) && $data[0] === false){ dieout(l(bad("Error: " . $data[1] . "/" . $data[2]))); }
Expand Down

0 comments on commit 44c462e

Please sign in to comment.