aurelg / feedspora

FeedSpora posts RSS/Atom feeds to your social network accounts.
35 stars 5 forks source link

Wrong estimation of the maximum length of a tweet resulting in missing hashtags / wrong content #37

Closed aurelg closed 5 years ago

aurelg commented 5 years ago

Until commit ff852be, the maximum "usable" length of a tweet was calculated by removing 22 from the maximum length (280), because twitter counted embedded links as 22 characters (or maybe 20, with a small margin, I don't remember), as URLs are wrapped with t.co (see here). (code is here).

The commit c1d6499 introduced a change, by also removing the full length of the link URL to post. Posting long links consequently drastically reduces the number of available characters for the post content and associated hashtags. (code is here).

Since Twitter automatically wraps links with t.co, and unless I am missing something, I think this is a bug that should be fixed by removing len(post_url). Moreover, the old value of 22 for self._link_cost (here) should be updated to 23, see here (I assume this document is up to date, I haven't called the API directly).

@wilddeej Any thoughts about this?

wilddeej commented 5 years ago

That could be, although that was also about the same time the URL shorteners went in. It's certainly worth checking into further, however. I am unsure how Twitter counts the character limit: is it the displayed characters, or the characters with the t.co link shortening applied. These can be very different, of course. That also needs to be researched and taken into account. Finally, I don't think this issue is the direct cause behind related Issue

34, but these two should probably be investigated/resolved together.

On Thu, Dec 6, 2018 at 4:01 AM Aurélien Grosdidier notifications@github.com wrote:

Until commit ff852be https://github.com/aurelg/feedspora/commit/ff852bea6c5745ebe97556363f76a869dc07aafb, the maximum length of a tweet was calculated by removing 22 from the maximum length (280), because twitter counted embedded links as 22 characters (or maybe 20, with a small margin), as URLs are wrapped with t.co (see here https://developer.twitter.com/en/docs/basics/tco.html).

The commit c1d6499 https://github.com/aurelg/feedspora/commit/c1d6499e1bd13bf1ff675d5610f4f0f8deff0fac introduced a change, by also removing the full length of the link URL to post. Posting long links consequently drastically reduces the number of available character for the post content and associated hashtags.

Since Twitter automatically wraps links with t.co, I think this is a bug that should be solved. Moreover, the old value of 22 should be updated to 23, see here https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration (I assume this document is up to date, I haven't called the API directly).

Thoughts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aurelg/feedspora/issues/37, or mute the thread https://github.com/notifications/unsubscribe-auth/AXIWhqqXcatN7AxEHIlr-B70Us4-DXk3ks5u2PkdgaJpZM4ZGR4F .

aurelg commented 5 years ago

All the relevant information can be found in the link I added after t.co in the first paragraph, and in the last link. I updated both w/ commit 6671190