| 1 | package LinkEmbedder::Link::NHL; | ||
| 2 | use Mojo::Base 'LinkEmbedder::Link'; | ||
| 3 | |||
| 4 | has provider_name => 'NHL'; | ||
| 5 | has provider_url => sub { Mojo::URL->new('https://www.nhl.com') }; | ||
| 6 | |||
| 7 | sub learn_p { | ||
| 8 | my $self = shift; | ||
| 9 | my $path = $self->url->path->to_string; | ||
| 10 | return $self->SUPER::learn_p unless $path =~ m!^/video!; | ||
| 11 | |||
| 12 | $path =~ s!/video!video/embed!; | ||
| 13 | $self->{iframe_src} = "https://www.nhl.com/$path?autostart=false"; | ||
| 14 | $self->height(360) unless $self->height; | ||
| 15 | $self->width(540) unless $self->width; | ||
| 16 | $self->type('rich'); | ||
| 17 | $self->template->[1] = 'iframe.html.ep'; | ||
| 18 | $self->title("NHL Video"); | ||
| 19 | |||
| 20 | return Mojo::Promise->new->resolve($self); | ||
| 21 | } | ||
| 22 | |||
| 23 | 1; |