App-WebSearchUtils

 view release on metacpan or  search on metacpan

script/web-search  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/WebSearchUtils/web_search
# and generated automatically using Perinci::CmdLine::Gen version 0.501

use 5.010001;
use strict;
use warnings;
use Log::ger;

use Perinci::CmdLine::Any;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-10-10'; # DATE
our $DIST = 'App-WebSearchUtils'; # DIST
our $VERSION = '0.001'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/WebSearchUtils/web_search",
    program_name => "web-search",
    log => 1,
);

$cmdline->run;

# ABSTRACT: Open web search page in browser
# PODNAME: web-search

__END__

=pod

=encoding UTF-8

=head1 NAME

web-search - Open web search page in browser

=head1 VERSION

This document describes version 0.001 of web-search (from Perl distribution App-WebSearchUtils), released on 2022-10-10.

=head1 SYNOPSIS

B<web-search> [B<--action>=I<str>|B<--open-url>|B<--print-html-link>|B<--print-org-link>|B<--print-result-html-link>|B<--print-result-link>|B<--print-result-org-link>|B<--print-url>|B<--save-html>] [B<--append>=I<str>] [B<--config-path>=I<path>|B<-c>...



See examples in the L</EXAMPLES> section.

=head1 DESCRIPTION

This utility can save you time when you want to open multiple queries (with
added common prefix/suffix words) or specify some options like time limit. It
will formulate the search URL(s) then open them for you in browser. You can also
specify to print out the URLs instead.

Aside from standard web search, you can also generate/open other searches like
image, video, news, or map.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--action>=I<s>

What to do with the URLs.

Default value:

 "open_url"

Valid values:

 ["open_url","print_url","print_html_link","print_org_link","save_html","print_result_link","print_result_html_link","print_result_org_link"]

Instead of opening the queries in browser (C<open_url>), you can also do other
action instead.

B<Printing search URLs>: C<print_url> will print the search URL.
C<print_html_link> will print the HTML link (the <a> tag). And C<print_org_link>
will print the Org-mode link, e.g. C<[[url...][query]]>.

B<Saving search result HTMLs>: C<save_html> will first visit each search URL
(currently using L<Firefox::Marionette>) then save each result page to a file
named C<< E<lt>numE<gt>-E<lt>queryE<gt>.html >> in the current directory. Existing files will not be
overwritten; the utility will save to C<*.html.1>, C<*.html.2> and so on instead.

B<Extracting search result links>: C<print_result_link> will first will first
visit each search URL (currently using L<Firefox::Marionette>) then extract
result links and print them. C<print_result_html_link> and
C<print_result_org_link> are similar but will instead format each link as HTML
and Org link, respectively.

The C<print_result_*link> actions are not very useful for some search engines
like Google because result HTML page is obfuscated. Thus we can only extract all
links in each page instead of selecting (via DOM) only the actual search result
entry links, etc.

If you want to filter the links further by domain, path, etc. you can use
L<grep-url>.


=item B<--append>=I<s>

String to add at the end of each query.

=item B<--delay>=I<s>

Delay between opening each query.



( run in 0.687 second using v1.01-cache-2.11-cpan-39bf76dae61 )