Skip to content
This repository has been archived by the owner on Apr 4, 2018. It is now read-only.

validation.tweet_length behaves wrong #28

Open
sophiejames opened this issue Sep 22, 2014 · 2 comments
Open

validation.tweet_length behaves wrong #28

sophiejames opened this issue Sep 22, 2014 · 2 comments

Comments

@sophiejames
Copy link

Hi,

tweet = '#RobertHalf is looking for a 3+yrs ASP.NET Immediate Opening, apply now! (#Baltimore) #job http://workfor.us/roberthalftechnology/cp8n349'
twitter_text.TwitterText(tweet).validation.tweet_length()

return 128

while posting on twitter I get the error :

# Raw error: u'[{"message": "Status is over 140 characters.", "code": 186}]'

Indeed, it seems that the lib parses http://workfor.us/roberthalftechnology/cp8n349 as the unique url (and count 23 characters for it) while Twitter API considers ASP.NET as the unique url and count the second url for 46 characters!

@sophiejames
Copy link
Author

basically I guess you should not do this loop
https://github.com/dryan/twitter-text-py/blob/master/twitter_text/validation.py#L46-L50
but only consider the first url found !

@sophiejames
Copy link
Author

ok, I guess this is a bug on Twitter API since I can post this tweet manually on Twitter (the second url get shortened)!

https://twittercommunity.com/t/tweet-length-ok-in-twitter-user-interface-but-too-long-through-api/24087

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant