Giter Site home page Giter Site logo

net-twitter-lite's People

Contributors

aburch avatar semifor avatar thewatcher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

net-twitter-lite's Issues

NET::Twitter:Lite Twitter is over capacity problem

Hi.
I've find some problem with your module.
It happens when twiiter return http://twitter.com/503 error
You wait it wiil be in json, but it is html.
And api method return empty array.

I've find issue for twitter https://dev.twitter.com/issues/15
but until it will fix by twitter dev team, i've try to fix sub _parse_result (1682)
with adding (1689-1691)

sub parse_result {
my ($self, $res) = @
;

# workaround for Laconica API returning bools as strings
# (Fixed in Laconi.ca 0.7.4)
my $content = $res->content;
$content =~ s/^"(true|false)"$/$1/;
if ($content =~ /\<h2\>Twitter is over capacity.\<\/h2\>/) {
    die Net::Twitter::Lite::Error->new(http_response => $res);
}
my $obj = $self->_from_json($content);

# Twitter sometimes returns an error with status code 200
if ( $obj && ref $obj eq 'HASH' && exists $obj->{error} ) {
    die Net::Twitter::Lite::Error->new(twitter_error => $obj, http_response => $res);
}

return $obj if $res->is_success && defined $obj;

my $error = Net::Twitter::Lite::Error->new(http_response => $res);
$error->twitter_error($obj) if ref $obj;

die $error;

}

Hope this post help you.

show_status(id) method does not return 'extended_tweet' for tweets longer than 140 chars.

Hello,

Since twitter introduced tweets with 280 characters, if a tweet is long than 140 chars, the 'text' gets truncated and the full tweet is found in a new entity called extended_tweet->{full_text}. At the same time, a boolean 'truncated' can be used to determine if a tweet is longer than 140.

I hope Net:Twitter:Lite can be updated to include this. Thanks

Reference: https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/tweet-object

200: OK

My perl programs have suddenly started returning 200: OK and no data is included. This does not happen all the time. If we repeat the request several times it will eventually work. It does not seem to associated with any Twitter limits.

Missing comma: idtrim_user

     retweet
      retweet(id)
          Parameters: idtrim_user
                        ^,
          Required: id

Package: libnet-twitter-lite-perl
Version: 0.12008-1

SSL turned on by default

Today Twitter API changed its behavior and throws "403 Forbidden" if SSL is not used. Forcing 'ssl'=>1 fixes the issue.

SSL should be enabled by default from now on in Net::Twitter::Lite::WithAPIv1_1.

Impossible to authenticate on forked webservers

I'm using the Mojolicious framework, with its Hypnotoad server.

When there's only one server process, authentication goes smoothly. When there are 10 server processes running, authentication fails. See below the code I wrote for the two twitter pages (initial page, and callback page):

sub _nt {
        state $nt = Net::Twitter::Lite::WithAPIv1_1->new(
                ssl => 1,
                %{ $pconf->{'twitter'} },
        );
}

sub twitter {
        my $self = shift;

        my $auth_url = _nt->get_authentication_url(callback => $self->url_for('twitter_callback')->to_abs->to_string);

        return $self->redirect_to($auth_url);
}

sub twitter2 {
        my $self = shift;

        my $request_token = $self->param('oauth_token');
        my $verifier = $self->param('oauth_verifier');

        _nt->request_access_token(verifier => $verifier);

        return $self->render(text => 'happy');
}

Both with 1 process and with 10 processes running, I am correctly redirected to twitter's auth url, where I click "Yes" and get redirected to my twitter2 (callback) page.

But whereas with 1 process I get the twitter2 page saying "happy", when there are 10 processes the twitter2 page execution dies, with this error:

Missing required parameter 'token' at /home/pm/perl5/lib/perl5/Net/Twitter/Lite.pm line 181.

This looks like it happens because Net::Twitter::Lite requires the visitor to revisit the same webserver process when he returns from Twitter.com's authentication page.

If that is the case, then it seems like a bug of Net::Twitter::Lite, because there is no way to direct the user to exactly the same process.

Am I doing something wrong here?

API DELETE methods are not supported

There are 3 api methods that use the DELETE http method: delete_list, delete_list_member, unsubscribe_list. These methods fail with the message "unexpected http_method: DELETE". It seems to be from this spot in the code: https://github.com/semifor/net-twitter-lite/blob/master/src/net-twitter-lite.tt2#L323-352 It appears to be handling GET and POST methods, but not DELETE.

Here are the twitter api pages for reference.

Stale dev.twitter.com docs URLs

The man pages say e.g.,

DESCRIPTION
       This module provides a perl interface to the Twitter APIs.  See <https://dev.twitter.com/docs/api/1.1/overview> for a full
       description of the Twitter APIs.

That URL doesn't work anymore.

Doesn't work properly with newest perl modules

Steps to reproduce:

  1. Make a fresh ~/perl5 directory on your $HOME, and enable local::lib
  2. install cpanm
  3. cpanm -L ~/perl5 Net::OAuth
  4. cpanm -L ~/perl5 Net::Twitter::Lite
  5. do a $nt->get_authentication_url, and see that it takes 30 seconds to complete.

If however I use Ubuntu's default libwww-perl installation, by installing the two Net::* modules without the -L switch in cpanm, then get_authentication_url works fast.

I have tried this on two dedicated servers (Ubuntu 12.10 server), and on my Ubuntu 12.10 Server VMWare machine.

false wide character appearing in feed?

One of my sites is pulling in a link that turns partially into a wide character that I can't do anything about, although it will Dump correctly:

use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use Data::Dumper;
use Net::Twitter::Lite::WithAPIv1_1;

my $statusref;
my $nt = Net::Twitter::Lite::WithAPIv1_1 -> new( ssl => 1,consumer_key => $twitterkey,consumer_secret => $twittersecret,access_token => $authtoken,access_token_secret => $authsecret );

eval { $statusref = $nt->user_timeline({ screen_name => $twittername,count => 3,exclude_replies => 'true'}); };

1/
for my $status( @{$statusref} ){ print $statusref->{'text'}; }
will print munged:
Delighted to announce that we have newly confirmed speakers at the Troubled Families conference ...... http://t.co/H4az…

2/
for my $status( @{$statusref} ){ print Dumper( $statusref->{'text'} ); }
will print munged:
Delighted to announce that we have newly confirmed speakers at the Troubled Families conference ...... http://t.co/H4az\x{2026}

3/
however
print Dumper($statusref) ;
will print correctly:

{'text' => 'Delighted to announce that we have newly confirmed speakers at the Troubled Families conference ...... http://t.co/H4azs3r0Qw #families2014'}

how can I get $statusref to print correctly, as it does in Dumper, in example 3?
binmode STDOUT,'utf8'; only removes the warning and no decoding/encoding I can come up with seems to work..

The unruly feed is from Feb 18 at https://twitter.com/Barrachd

Thanks,
Dave

Problem with unicode and update_with_media

If you try and use Net::Twitter::Lite::WithAPIv1_1 and try and send a
status update with unicode characters, and you post a picture (and so
use update_with_media), then you get a failure from HTTP::Request:


HTTP::Message content must be bytes at /usr/lib/perl5/site_perl/5.8.8/HTTP/Request/Common.pm
Reported on RT by Philip Gladstone [email protected], 19-Oct-2014.

POD Bug - $nt->request_access_token called without verifier

There seems to be a minor issue with the documentation:

my($access_token, $access_token_secret, $user_id, $screen_name) =
          $nt->request_access_token;

Should be:

my($access_token, $access_token_secret, $user_id, $screen_name) =
          $nt->request_access_token(verifier => $verifier);

where $verifier is $c->req->param->{oauth_verifier}

This is documented correctly in Net::Twitter but seems to have been missed out in Net::Twitter::Lite

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.