Easily link the contents of any entity within a Tweet from the Twitter API.
Tweemat is a lightweight script that takes any entity from a Twitter API timeline and nicely formats it for the web. From the plain text contents of tweet's text, it will find all mentions of users, media, links, and hashtags and replace them with their proper links and display URLs. Tweemat is capable of being used within Node.JS, AMD, or the browser.
Downloading
Node.js
npm install tweemat --save
Bower
bower install --save tweemat
Other
-
Clone the repo:
git clone https://github.com/dcompute/tweemat.git
or download the latest ZIP. -
Move
./tweemat/src/tweemat.js
to the desired directory within your project.
Adding to Your Project
Node.js
var Tweemat = require('tweemat');
Browser
<script src="tweemat.js"></script>
Require.js
require.config({
paths: {
"Tweemat": "path/to/tweemat",
}
});
define(["Tweemat"], function (Tweemat) {
...
});
Using
Tweemat is designed for use on single tweet representations. To work with a tweet, create an object from the Tweemat constructor by passing it a single tweet representation.
var tweet = new Tweemat(twitterTimeline[tweetIndex]);
return '<li>' + tweet.linkAllEntities() + '</li>';
Documentation
JSDoc output for Tweemat can be found in the Wiki.