root/trunk/plagger/assets/plugins/CustomFeed-Script/lingr.pl

Revision 1917 (checked in by miyagawa, 2 years ago)

CF::Script for Lingr

  • Property svn:executable set to *
Line 
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use WebService::Lingr;
5 use YAML;
6
7 my($api_key, $room) = @ARGV;
8
9 my $output = {
10     title => "Lingr: $room",
11     entry => [],
12 };
13
14 my $lingr = WebService::Lingr->new(api_key => $api_key);
15 $lingr->call('room.enter', { id => $room });
16 $lingr->call('room.getMessages', {
17     ticket => $lingr->response->{ticket},
18     counter => 0,
19 });
20
21 for my $msg (@{$lingr->response->{messages} || []}) {
22     push @{$output->{entry}}, {
23         title  => $msg->{text},
24         date   => $msg->{timestamp},
25         author => $msg->{nickname},
26         url    => "http://www.lingr.com/room/$room#$msg->{id}", # fake URL
27     };
28 }
29
30 print Dump $output;
31
32
33
Note: See TracBrowser for help on using the browser.