aboutsummaryrefslogtreecommitdiffstats
path: root/lib/WWW/StrawViewer/Search.pm
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2020-03-02 08:18:54 -0500
committerJesús <heckyel@hyperbola.info>2020-03-02 08:18:54 -0500
commitc67158fa409f1b1b4f98a8621a69bb2013b76451 (patch)
treebb4ca80f29cda70734a868d372e00c85e172e7d3 /lib/WWW/StrawViewer/Search.pm
parentad7ec1785fc28799e10d10e7a679dc5bb4891ee3 (diff)
downloadfair-viewer-c67158fa409f1b1b4f98a8621a69bb2013b76451.tar.lz
fair-viewer-c67158fa409f1b1b4f98a8621a69bb2013b76451.tar.xz
fair-viewer-c67158fa409f1b1b4f98a8621a69bb2013b76451.zip
rebrand app
Diffstat (limited to 'lib/WWW/StrawViewer/Search.pm')
-rw-r--r--lib/WWW/StrawViewer/Search.pm175
1 files changed, 0 insertions, 175 deletions
diff --git a/lib/WWW/StrawViewer/Search.pm b/lib/WWW/StrawViewer/Search.pm
deleted file mode 100644
index 67b8982..0000000
--- a/lib/WWW/StrawViewer/Search.pm
+++ /dev/null
@@ -1,175 +0,0 @@
-package WWW::StrawViewer::Search;
-
-use utf8;
-use 5.014;
-use warnings;
-
-=head1 NAME
-
-WWW::StrawViewer::Search - Search functions for Straw API v3
-
-=head1 SYNOPSIS
-
- use WWW::StrawViewer;
- my $obj = WWW::StrawViewer->new(%opts);
- $obj->search_videos(@keywords);
-
-=head1 SUBROUTINES/METHODS
-
-=cut
-
-sub _make_search_url {
- my ($self, %opts) = @_;
-
- return $self->_make_feed_url(
- 'search',
-
- topicId => $self->get_topicId,
- regionCode => $self->get_regionCode,
-
- maxResults => $self->get_maxResults,
- order => $self->get_order,
- publishedAfter => $self->get_publishedAfter,
- publishedBefore => $self->get_publishedBefore,
- regionCode => $self->get_regionCode,
- relevanceLanguage => $self->get_relevanceLanguage,
- safeSearch => $self->get_safeSearch,
- channelId => $self->get_channelId,
- channelType => $self->get_channelType,
- pageToken => $self->page_token,
-
- (
- $opts{type} eq 'video'
- ? (
- videoCaption => $self->get_videoCaption,
- videoCategoryId => $self->get_videoCategoryId,
- videoDefinition => $self->get_videoDefinition,
- videoDimension => $self->get_videoDimension,
- videoDuration => $self->get_videoDuration,
- videoEmbeddable => $self->get_videoEmbeddable,
- videoLicense => $self->get_videoLicense,
- videoSyndicated => $self->get_videoSyndicated,
- videoType => $self->get_videoType,
- eventType => $self->get_eventType,
- )
- : ()
- ),
-
- %opts,
- );
-
-}
-
-=head2 search_for($types,$keywords;\%args)
-
-Search for a list of types (comma-separated).
-
-=cut
-
-sub search_for {
- my ($self, $type, $keywords, $args) = @_;
-
- $keywords //= [];
- if (ref $keywords ne 'ARRAY') {
- $keywords = [split ' ', $keywords];
- }
-
- my $url = $self->_make_search_url(
- type => $type,
- q => $self->escape_string(join(' ', @{$keywords})),
- (ref $args eq 'HASH' ? %{$args} : (part => 'snippet')),
- );
-
- return $self->_get_results($url);
-}
-
-{
- no strict 'refs';
-
- foreach my $pair (
- {
- name => 'videos',
- type => 'video',
- },
- {
- name => 'playlists',
- type => 'playlist',
- },
- {
- name => 'channels',
- type => 'channel',
- },
- {
- name => 'all',
- type => 'video,channel,playlist',
- }
- ) {
- *{__PACKAGE__ . '::' . "search_$pair->{name}"} = sub {
- my $self = shift;
- $self->search_for($pair->{type}, @_);
- };
- }
-}
-
-=head2 search_videos($keywords;\%args)
-
-Search and return the found video results.
-
-=cut
-
-=head2 search_playlists($keywords;\%args)
-
-Search and return the found playlists.
-
-=cut
-
-=head2 search_channels($keywords;\%args)
-
-Search and return the found channels.
-
-=cut
-
-=head2 search_all($keywords;\%args)
-
-Search and return the results.
-
-=cut
-
-=head2 related_to_videoID($id)
-
-Retrieves a list of videos that are related to the video
-that the parameter value identifies. The parameter value must
-be set to a YouTube video ID.
-
-=cut
-
-sub related_to_videoID {
- my ($self, $id) = @_;
- return $self->search_for('video', [], {relatedToVideoId => $id});
-}
-
-=head1 AUTHOR
-
-Trizen, C<< <echo dHJpemVuQHByb3Rvbm1haWwuY29tCg== | base64 -d> >>
-
-
-=head1 SUPPORT
-
-You can find documentation for this module with the perldoc command.
-
- perldoc WWW::StrawViewer::Search
-
-
-=head1 LICENSE AND COPYRIGHT
-
-Copyright 2013-2015 Trizen.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms of either: the GNU General Public License as published
-by the Free Software Foundation; or the Artistic License.
-
-See L<http://dev.perl.org/licenses/> for more information.
-
-=cut
-
-1; # End of WWW::StrawViewer::Search