discourse-legacysite-perl/site/slowtwitch.com/cgi-bin/articles/admin/twitter.cgi
2024-06-17 21:49:12 +10:00

59 lines
1.6 KiB
Perl
Executable File

#!/usr/bin/perl
use strict;
use lib '/var/home/slowtwitch/slowtwitch.com/cgi-bin/articles/admin';
use Links qw/:objects/;
$| = 1;
local $SIG{__DIE__} = \&Links::fatal;
Links::init('/var/home/slowtwitch/slowtwitch.com/cgi-bin/articles/admin');
use Net::Twitter;
#use Scalar::Util 'blessed';
use Plugins::SocialMedia;
my $id = 4003;
Plugins::SocialMedia::post_twitter($id);
exit;
# When no authentication is required:
my $nt = Net::Twitter->new(legacy => 0);
my $consumer_key = "u4xwsqHZBKrdWYPrKCm8Lw";
my $consumer_secret = "vjDF6FjeoPJW0WVwgqMEJeuJzilgSIu5QbPGQnWrMI";
my $token = "1921299666-fMicJMBunBjgBb4ieszHo6tYV0mQcbbaMZU5wSB";
my $token_secret = "Ko9gPpBaLxqQj6u68EWdlgnPinGSseVzrzUvytWric";
# As of 13-Aug-2010, Twitter requires OAuth for authenticated requests
$nt = Net::Twitter->new(
traits => [qw/API::RESTv1_1/],
consumer_key => $consumer_key,
consumer_secret => $consumer_secret,
access_token => $token,
access_token_secret => $token_secret,
);
my $result = $nt->update('Hello, world2!');
use Data::Dumper;
print Dumper($result);
exit;
=tag
eval {
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";
}
};
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";
}
=cut