Bug#882390: libnet-twitter-perl: tweets are truncated to 140 characters

2017-11-24 Thread Vincent Lefevre
Control: retitle -1 libnet-twitter-perl: please document how to get extended 
tweets
Control: tags -1 - unreproducible

On 2017-11-24 23:21:56 +0100, gregor herrmann wrote:
> True but we might still fix the 140 character issue.
> 
> Except that I see no mention of "140" in the code (only in the POD)?!
> The update method seems to just POST to statuses/update, and that's
> it.

I'm not talking about the "update" method, but tweets that are read,
e.g. via user_timeline. The limit of 140 characters comes from Twitter,
with the old API. However, after searching a bit, I've found that it
doesn't need any code change. The POD documentation is just misleading
(one has the impression that it gives all the parameters that are
accepted) and incomplete with the current API.

According to

  https://developer.twitter.com/en/docs/tweets/tweet-updates

one needs the "Extended" mode for REST APIs.

For user_timeline, the documentation is:

   user_timeline
   Parameters: user_id, screen_name, since_id, max_id, count,
   trim_user, exclude_replies, include_rts, contributor_details
   Required: none
[...]

It should add the "tweet_mode" parameter, and say that it can be
set to "extended" for extended mode, and say that the tweet is
available in "full_text" instead of "text".

But since this applies to several methods, this could also be a
new section in the documentation. The initial example could also
be updated, by changing

 my $statuses = $nt->friends_timeline({ since_id => $high_water, 
count => 100 });
 for my $status ( @$statuses ) {
 print "$status->{created_at} <$status->{user}{screen_name}> 
$status->{text}\n";

to

 my $statuses = $nt->friends_timeline({ since_id => $high_water, 
count => 100, tweet_mode => 'extended' });
 for my $status ( @$statuses ) {
 print "$status->{created_at} <$status->{user}{screen_name}> 
$status->{full_text}\n";

(not tried on this particular example, but this worked in my scripts
for home_timeline and user_timeline).

BTW, the URL's to the API documentation are obsolete, so that this
didn't help at the beginning.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Bug#882390: libnet-twitter-perl: tweets are truncated to 140 characters

2017-11-24 Thread gregor herrmann
Control: tag -1 + unreproducible

On Fri, 24 Nov 2017 13:04:49 +0100, Florian Schlichting wrote:

> > Some time ago, Twitter has extended tweets to more than 140 characters.
> > But with Net::Twitter, tweets are truncated to 140 characters, and
> > even less (because they include a link to get the full tweet when this
> > occurs). This makes this module rather useless nowadays.
> > 
> > This module should be updated to the current Twitter API.
> 
> in https://github.com/semifor/Net-Twitter/issues/76 the upstream author
> makes clear that he considers Net::Twitter a dead end and has deprecated
> it in favour of Twitter::API. In fact, the git repo has added the
> following notice:
> 
> This module has been superseded by L. Please update as
> soon as you possibly can to use new features and the new API
> versions. This module will no longer be supported.

True but we might still fix the 140 character issue.

Except that I see no mention of "140" in the code (only in the POD)?!
The update method seems to just POST to statuses/update, and that's
it.

So let's try ...

*a bit later*

With the result of the attached script I got (no error, exit status
0, and): https://twitter.com/gregoa_/status/934184021684301824
(length 188 characters)


So I can't reproduce a 140 character limit in Net::Twitter.


Cheers,
gregor
 

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   NP: Led Zeppelin: Dazed And Confused
#/usr/bin/perl

use strict;
use warnings;
use Net::Twitter;
use Scalar::Util 'blessed';

my $nt = Net::Twitter->new(
traits  => [qw/API::RESTv1_1/],
consumer_key=> ...,
consumer_secret => ...,
access_token=> ...,
access_token_secret => ...,
);

my $tweet
= 'Test for https://bugs.debian.org/882390 - what does Net::Twitter do with long messages? '
. '0123456789' x 10;

my $result = $nt->update($tweet);

if ( my $err = $@ ) {
die $@ unless blessed $err && $err->isa('Net::Twitter::Error');

warn "HTTP Response Code: ", $err->code, "\n",
 "HTTP Message..: ", $err->message, "\n",
 "Twitter error.: ", $err->error,   "\n";
}


signature.asc
Description: Digital Signature


Bug#882390: libnet-twitter-perl: tweets are truncated to 140 characters

2017-11-24 Thread Florian Schlichting
Hi Vincent,

> Some time ago, Twitter has extended tweets to more than 140 characters.
> But with Net::Twitter, tweets are truncated to 140 characters, and
> even less (because they include a link to get the full tweet when this
> occurs). This makes this module rather useless nowadays.
> 
> This module should be updated to the current Twitter API.

in https://github.com/semifor/Net-Twitter/issues/76 the upstream author
makes clear that he considers Net::Twitter a dead end and has deprecated
it in favour of Twitter::API. In fact, the git repo has added the
following notice:

This module has been superseded by L. Please update as
soon as you possibly can to use new features and the new API
versions. This module will no longer be supported.

Unfortunately, Twitter::API doesn't seem to be packaged in Debian, and
its POD says "This in an alpha release. The interface may change." ...

Florian



Bug#882390: libnet-twitter-perl: tweets are truncated to 140 characters

2017-11-21 Thread Vincent Lefevre
Package: libnet-twitter-perl
Version: 4.01041-1
Severity: important

Some time ago, Twitter has extended tweets to more than 140 characters.
But with Net::Twitter, tweets are truncated to 140 characters, and
even less (because they include a link to get the full tweet when this
occurs). This makes this module rather useless nowadays.

This module should be updated to the current Twitter API.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.13.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=POSIX 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libnet-twitter-perl depends on:
ii  libcarp-clan-perl  6.06-1
ii  libclass-load-perl 0.24-1
ii  libcrypt-ssleay-perl   0.73.04-2+b2
ii  libdata-visitor-perl   0.30-2
ii  libdatetime-format-strptime-perl   1.7400-1
ii  libdatetime-perl   2:1.44-1
ii  libdevel-stacktrace-perl   2.0200-1
ii  libdigest-hmac-perl1.03+dfsg-1
ii  libhtml-parser-perl3.72-3+b2
ii  libio-socket-ssl-perl  2.052-1
ii  libjson-maybexs-perl   1.003009-1
ii  liblwp-protocol-https-perl 6.07-2
ii  libmoose-perl  2.1807-1+b1
ii  libmoosex-role-parameterized-perl  1.10-1
ii  libnamespace-autoclean-perl0.28-1
ii  libnet-http-perl   6.17-1
ii  libnet-oauth-perl  0.28-2
ii  libtry-tiny-perl   0.28-1
ii  liburi-perl1.72-2
ii  libwww-perl6.29-1
ii  perl   5.26.1-2

libnet-twitter-perl recommends no packages.

libnet-twitter-perl suggests no packages.

-- no debconf information