add florolfs media.ccc.de api example
parent
203a86c887
commit
7727d1da68
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use v5.12;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Data::Dumper;
|
||||
use LWP::Simple;
|
||||
use JSON;
|
||||
|
||||
if(@ARGV != 1) {
|
||||
say STDERR "usage: $0 conference_id";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my ($conference_id) = @ARGV;
|
||||
|
||||
sub get_conference {
|
||||
my ($id) = @_;
|
||||
|
||||
my $json = get("http://api.media.ccc.de/public/conferences/$id");
|
||||
|
||||
return decode_json($json);
|
||||
}
|
||||
|
||||
sub get_event {
|
||||
my ($event) = @_;
|
||||
|
||||
my $json = get($event->{url});
|
||||
|
||||
return decode_json($json);
|
||||
}
|
||||
|
||||
my $conference = get_conference($conference_id);
|
||||
|
||||
foreach my $ev (@{$conference->{events}}) {
|
||||
my $event = get_event($ev);
|
||||
|
||||
my $url = $event->{frontend_link};
|
||||
#$url =~ s!\.html!/oembed.html!g;
|
||||
|
||||
printf qq!=== %s ===\n!, $event->{title};
|
||||
printf qq!<pre>* Vortragsvideo/Download bei [%s media.ccc.de]</pre>\n!, $url;
|
||||
}
|
Reference in New Issue