A node API that uses twitter-text API library to parse tweet can calculate its length.
- Node installed.
- Clone repository
- Run
npm run start
- Do a post request:
curl -X POST \
http://localhost:3000/calculateLength \
-H 'Content-Type: application/json' \
-d '{
"text": "testing tweet length ๐ http://test.com."
}'
- The response will be like:
{
"weightedLength": 48,
"valid": true,
"permillage": 171,
"validRangeStart": 0,
"validRangeEnd": 39,
"displayRangeStart": 0,
"displayRangeEnd": 39
}
- Deploy to your server or to a cloud service