diff --git a/bin/Makefile b/bin/Makefile index d44567c..7c05283 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -10,15 +10,20 @@ # . .POSIX: .SUFFIXES: -.SUFFIXES: .sh .c +.SUFFIXES: .sh .c .pl PREFIX = $(HOME) MANPREFIX = $(PREFIX)/local 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 BROWSER_LINKS = tor-browser +.pl: + cp -f $< $@ + chmod +x $@ + all: $(BIN) clean: diff --git a/bin/nyaasearch.pl b/bin/nyaasearch.pl new file mode 100644 index 0000000..fa8284b --- /dev/null +++ b/bin/nyaasearch.pl @@ -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 +# . + +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";