Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- #
- # # 04.05.2020
- # surfraw.cgi for w3m
- # barely tested and created by Jonny Högsten aka frakswe
- # (learned from w3m/Bonus/google.cgi & surfraw/examples/hooks.lua)
- #
- # if the script doesn't execute properly please cut and paste it or
- # make sure the line-endings are set correctly for your system,
- # pastebin downloads by default appears to be in dos/windows format.
- #
- # example-usage: open urlinput and type for ex. "youtube:gotbletu"
- # or in the commandline: "w3m urban:woke"
- # to do multistring searching you have to use a "+" character instead of space,
- # for ex. google:get+woke+go+broke
- #
- # installation:
- # 1:
- # > sudo cp ./surfraw.cgi /usr/local/libexec/w3m/cgi-bin/
- # > sudo chmod +x /usr/local/libexec/w3m/cgi-bin/surfraw.cgi
- #
- # 2:
- # create file if not already existing:
- # > touch ~/.w3m/urimethodmap
- #
- # and do for ex.:
- # > echo 'google: file:/cgi-bin/surfraw.cgi?%s
- # duckduckgo: file:/cgi-bin/surfraw.cgi?%s
- # stack: file:/cgi-bin/surfraw.cgi?%s
- # youtube: file:/cgi-bin/surfraw.cgi?%s
- # urban: file:/cgi-bin/surfraw.cgi?%s' >>~/.w3m/urimethodmap
- #
- # ([elvi]: file:/cgi-bin/surfraw.cgi%s)
- # w3m needs to be restarted each time you make changes in the urimethodmap file.
- #
- # 3:
- # Go into w3m's settings and add under Directory Settings:
- # Directory corresponding to cgi-bin /usr/local/libexec/w3m/cgi-bin
- #
- #
- $search = $ENV{"QUERY_STRING"};
- $search =~ tr/:/ /;
- $search =~ tr/+/ /;
- $url = `surfraw -p $search`;
- print <<EOF;
- w3m-control: GOTO $url
- EOF
Add Comment
Please, Sign In to add comment