Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
use URI;
use utf8;
my $keyword = 'Serverless';
my $baseurl = "";
my $agent = LWP::UserAgent->new;
my $uri = URI->new($baseurl);
$uri->query_form(keyword => $keyword, count => 100);
my $res = $agent->get($uri->as_string);
die $res->status_line if !$res->is_success;
my $data = decode_json($res->content);
my $result = {};
for my $row (@{$data->{events}}) {
my $date = substr($row->{started_at}, 0, 7);
$result->{$date} ||= 0;
$result->{$date} ++;
for my $date (sort keys %$result) {
printf "%s %s\n", $date, $result->{$date};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment