Group
Extension

Matches 3

Web-oEmbed ( M/MI/MIYAGAWA/Web-oEmbed-0.04.tar.gz, MIYAGAWA, 2009; MetaCPAN )
Web-oEmbed/tools/fetch-providers.pl ( view source; MetaCPAN )
#!/usr/bin/perl
use strict;
use JSON::XS;
use Web::Scraper;
use URI;

sub extract_url { (m!(http://\S*)!)[0] }

my $uri = URI->new( shift || "http://www.oembed.com/" );

my $scraper = scraper {
    pr
(text(), 'Endpoint')]", api => [ 'TEXT', \&extract_url ];
    };
    result 'providers';
};

my @providers = grep { defined $_->{url} } @{ $scraper->scrape($uri) };
print encode_json(\@providers);



Web-oEmbed ( M/MI/MIYAGAWA/Web-oEmbed-0.04.tar.gz, MIYAGAWA, 2009; MetaCPAN )
Web-oEmbed/lib/Web/oEmbed/Response.pm ( view source; MetaCPAN )
_res, matched_uri => $uri );

    my $data;
    if ($http_res->content_type =~ /json/) {
        $data = $res->parse_json($http_res->content);
    } elsif ($http_res->content_type =~ /xml/) {
        
ata = $res->parse_xml($http_res->content);
    } else {
        croak "Content-Type is not either JSON or XML: " . $http_res->content_type;
    }

    for my $key (keys %$data) {
        if ($res->can
= $data->{$key};
        }
    }

    $res;
}

sub parse_json {
    my($self, $json) = @_;
    require JSON::XS;
    JSON::XS->new->decode($json);
}

sub parse_xml {
    my($self, $xml) = @_;
    requ
Web-oEmbed ( M/MI/MIYAGAWA/Web-oEmbed-0.04.tar.gz, MIYAGAWA, 2009; MetaCPAN )
Web-oEmbed/lib/Web/oEmbed.pm ( view source; MetaCPAN )
t;
use 5.8.1;
our $VERSION = '0.04';

use Any::Moose;
has 'format'    => (is => 'rw', default => 'json');
has 'discovery' => (is => 'rw');
has 'providers' => (is => 'rw', isa => 'ArrayRef', default =>
bed consumer

=head1 SYNOPSIS

  use Web::oEmbed;

  my $consumer = Web::oEmbed->new({ format => 'json' });
  $consumer->register_provider({
      url  => 'http://*.flickr.com/*',
      api  => 'http:


=over 4

=item new

  $consumer = Web::oEmbed->new;
  $consumer = Web::oEmbed->new({ format => 'json' });

Creates a new Web::oEmbed instance. You can specify the default format
that will be used wh

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.