nyaasearch: add script for searching nyaa.si with w3m

This commit is contained in:
Lucas 2021-03-12 00:10:37 +00:00
parent 2a35d39180
commit 02faa7d7bb
2 changed files with 39 additions and 2 deletions

View File

@ -10,15 +10,20 @@
# <http://creativecommons.org/publicdomain/zero/1.0/>. # <http://creativecommons.org/publicdomain/zero/1.0/>.
.POSIX: .POSIX:
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .sh .c .SUFFIXES: .sh .c .pl
PREFIX = $(HOME) PREFIX = $(HOME)
MANPREFIX = $(PREFIX)/local MANPREFIX = $(PREFIX)/local
BIN = ZZZ browser credentials fetch flac2ogg imgresize invidious \ BIN = ZZZ browser credentials fetch flac2ogg imgresize invidious \
plumb pstsrv rfcopen screenshot sekrit w3m-copy-link nyaasearch plumb pstsrv rfcopen screenshot sekrit \
w3m-copy-link
MAN1 = sekrit.1 MAN1 = sekrit.1
BROWSER_LINKS = tor-browser BROWSER_LINKS = tor-browser
.pl:
cp -f $< $@
chmod +x $@
all: $(BIN) all: $(BIN)
clean: clean:

32
bin/nyaasearch.pl Normal file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env perl
# nyaasearch
# Written in 2021 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
use v5.14;
use strict;
use warnings;
my $progname = $0;
$progname =~ s@^.*/@@;
sub usage
{
say STDERR "Usage: $progname QUERY";
exit 1;
}
usage if @ARGV == 0;
my $s = join(" ", @ARGV);
$s =~ s/[^A-Za-z0-9\-\._~]/sprintf("%%%02X", ord($&))/eg;
$s =~ s/%20/+/g;
exec "w3m", "https://nyaa.si/?q=$s&f=0&c=0_0";