semifor / net-twitter-lite Goto Github PK
View Code? Open in Web Editor NEWA lighter weight (non-Moose) Perl interface to the Twitter API
License: Other
A lighter weight (non-Moose) Perl interface to the Twitter API
License: Other
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.
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
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.
retweet
retweet(id)
Parameters: idtrim_user
^,
Required: id
Package: libnet-twitter-lite-perl
Version: 0.12008-1
https://rt.cpan.org/Public/Bug/Display.html?id=116693
Sorry for duplication, but could you require LWP::Protocol::https instead of Crypt::SSLeay?
Thank you.
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
.
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?
I get this error message sometimes, it's weird because it doesn't interfere with Net::Twitter::Lite operation (meaning it still executes fine the Twitter methods, I just find this in my error logs). Any idea why would it do that?
The streaming sections defines several endpoints. None of these are present in the Net::Twitter::Lite::API::v1_1.pm. See https://dev.twitter.com/docs/api/1.1#334
Are these outside the realm of a "Lite" library?
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.
Net::Twitter::Lite is using LWP::UserAgent->add_handler. and its supported in 5.815.
http://cpansearch.perl.org/src/GAAS/libwww-perl-5.826/Changes
http://github.com/matsuu/net-twitter-lite/commit/3818e3869069d3b8ef14ebaf12cba72e9604cf9e
btw, some tests in Net::Twitter have same issue.
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.
similar_places doesn't seem to still be documented on https://developer.twitter.com/ , although it still works.
Maybe it is going away.
Hello,
I've been using Net::Twitter::Lite for several years. I want to say thank you at first.
I recently heard a news like this:
https://blog.twitter.com/developer/en_us/topics/tools/2017/announcing-more-functionality-to-improve-customer-engagements-on-twitter.html
I'm afraid that my Perl script would stop working after those API changes are applied.
I'd like to ask if any work is doing on this module.
Thank you.
Steps to reproduce:
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.
I found Net::Twitter::Lite update for API v1.1, but I wonder why you separate class for API v1.1 from one for v1.
Twitter says in https://dev.twitter.com/blog/planning-for-api-v1-retirement
When API v1 is finally retired, all authenticated and unauthenticated requests to API v1 will return a HTTP 410 Gone status.
So I think you can remove v1 interface and support v1.1 in lib/Net/Twitter/Lite.pm.
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
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.
print Dumper $nt->geo_search($lat, $long);
geo_search expected 0 args.
Say instead
geo_search expected a hash.
I want to ask,,how to get [name] =>
from twitter..
like this example:
http://apiwiki.twitter.com/Twitter-API-Documentation
http://twitteroauth.labs.poseurtech.com/index.php
thanks
I'm still getting it. Github won't let me re-open a closed problem, so this is a place holder.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.