tweetnest icon indicating copy to clipboard operation
tweetnest copied to clipboard

Does Tweetnest already support the new 280 characters tweet length?

Open RobThree opened this issue 6 years ago • 6 comments

https://blog.twitter.com/official/en_us/topics/product/2017/tweetingmadeeasier.html

RobThree avatar Nov 08 '17 11:11 RobThree

It looks to me like the text column of the tn_tweets is set to VARCHAR(510). My MySQL is a little rusty but I think at least the database should be good up to 510 characters. I'm not sure why that number was chosen though.

alexmuller avatar Nov 08 '17 13:11 alexmuller

Hmmm, my database is varchar(255); maybe an older version. I'll do some deeper digging when I get around to it (also to see what it takes to make Tweetnest support long(er) tweets if not already supported).

RobThree avatar Nov 08 '17 13:11 RobThree

I've made a quick hack to solve this temporarily:

  • Change the textcolumn of tn_tweetsto varchar(512) (if twitter changes the limit again...)
  • in the class.twitter.api.php file, replace (at the top):
		public $dbMap = array(
			"id_str"       => "tweetid",
			"created_at"   => "time",
			"text"         => "text",
			"source"       => "source",
			"coordinates"  => "coordinates",
			"geo"          => "geo",
			"place"        => "place",
			"contributors" => "contributors",
			"user.id"      => "userid"
		);

with

		public $dbMap = array(
			"id_str"       => "tweetid",
			"created_at"   => "time",
			"full_text"    => "text",
			"text"         => "text",
			"source"       => "source",
			"coordinates"  => "coordinates",
			"geo"          => "geo",
			"place"        => "place",
			"contributors" => "contributors",
			"user.id"      => "userid"
		);

I added a mapping between full_text to text because twitter returns the 280 chars tweets in the full_text field.

in the loadtweets.php file, line 127, add this line:

$params['tweet_mode'] = 'extended'; (before the $data = $twitterApi->query('statuses/user_timeline', $params); line) so Twitter returns the extended tweets.

That's all.

EDIT: it appears I didnt run the upgrade.php script last time I updated TweetNest. The tweets field is now varchar(510) EDIT2: My tables are prefixed with tn_, so make the changes for your config.

sburlot avatar Nov 17 '17 10:11 sburlot

Any good suggestions for an easy way to re-import longer tweets that already got truncated?

sr4136 avatar Feb 23 '18 21:02 sr4136

I deleted all messages directly in the mysql database between the 280’s Twitter update and the moment when I make the change.

Albanj avatar Feb 23 '18 22:02 Albanj

If you are like me and had an outdated version full of ..., you can just delete everything since the change and then load tweets. I tried targeting the character directly but unfortunately it doesn't reload them automatically (it looks for the most recent tweet and if it's there, won't load anymore). I didn't feel like modifying the code so I ran:

DELETE FROM `tn_tweets` WHERE `time` > '1509462910';

melissamcewen avatar Mar 14 '18 21:03 melissamcewen