[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-97-ge9eed2d
Ian Beckwith
ianb at erislabs.net
Fri Apr 16 16:51:49 UTC 2010
The following commit has been merged in the master branch:
commit e9eed2dd348b66c2c2617432dda68d0835fbb3df
Author: Ian Beckwith <ianb at erislabs.net>
Date: Fri Apr 16 17:51:11 2010 +0100
new elvi: scroogle & duckduckgo
diff --git a/AUTHORS b/AUTHORS
index 4393036..b0219f1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -13,7 +13,7 @@ Ian Beckwith <ianb at erislabs.net>
opensearch, scholar, ctan, fsfdir, gutenberg, wayback,
dmoz, w3html, w3link, w3css, w3rdf, debpts, rfc,
sunonesearch, lsm, finkpkg, rpmsearch, macports,
- debpkghome, debvcsbrowse
+ debpkghome, debvcsbrowse, scroogle, duckduckgo
plus various tweaks/bugfixes/features.
Moritz Muehlenhoff <jmm at informatik.uni-bremen.de>
diff --git a/ChangeLog b/ChangeLog
index 75ec189..304b18c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-16 Ian Beckwith <ianb at erislabs.net>
+
+ * New elvi:
+ + scroogle: Search Google anonymously via www.scroogle.org
+ + duckduckgo: Search the web via duckduckgo.com
+
2010-03-01 Ian Beckwith <ianb at erislabs.net>
* Removed autotools-generated files from git repo
diff --git a/README b/README
index cedc898..eeb78fa 100644
--- a/README
+++ b/README
@@ -161,12 +161,12 @@ amazon -- Search the amazon.com bookstore
archpkg -- Search Arch Linux packages (www.archlinux.org)
arxiv -- Search arXiv E-Print Archive for articles
ask -- Question the web using Ask Jeeves (www.ask.com)
-aur -- Search aur.archlinux.org for PKGBUILDS
+aur -- Search aur.archlinux.org for PKGBUILDs
austlii -- Search Australian Law docs (www.austlii.edu.au)
-bing -- Search the web using Microsoft's Bing (www.bing.com)
bbcnews -- Search BBC News (news.bbc.co.uk)
-bookfinder -- Search for books (www.bookfinder.com)
-bugmenot -- Bypass compulsory Web registration (www.bugmenot.com)
+bing -- Search the web using Microsoft's Bing (www.bing.com)
+bookfinder -- Search for books using www.bookfinder.com
+bugmenot -- Bypass compulsory web registration with bugmenot.com
cddb -- Search for cd track listings in CDDB (www.gracenote.com)
cia -- Search CIA documents at www.cia.gov
cite -- Search computer science papers (citeseerx.ist.psu.edu)
@@ -190,6 +190,7 @@ debwiki -- Search the Debian Wikis (wiki.debian.org & women.debian.org/w
deja -- Search usenet using Google Groups (groups.google.com)
discogs -- Search the Discogs database of music information (www.discogs.com)
dmoz -- Search the Open Directory Project web directory (dmoz.org)
+duckduckgo -- Search the web using Duckduckgo (www.duckduckgo.com)
ebay -- Search the Ebay auction site
etym -- Look up word origins at www.etymonline.com
excite -- Search on Excite (www.excite.com)
@@ -215,7 +216,7 @@ l1sp -- Search lisp documentation
lastfm -- Search last.fm
leodict -- Search Leo's German <-> English dictionary (dict.leo.org)
lsm -- Search the Linux Software Map
-macports -- Search macports packages (macports.org)
+macports -- Search macports packages (macports.org)
mathworld -- Search Wolfram MathWorld
mininova -- Search the mininova bittorent source.
musicbrainz -- Search MusicBrainz (musicbrainz.org)
@@ -234,6 +235,7 @@ rpmsearch -- Search for RPMs in various distros
scholar -- Search Google Scholar (scholar.google.com)
scicom -- Search Scientific Commons
scpan -- Search the Comprehensive Perl Archive Network (search.cpan.org)
+scroogle -- Search Google anonymously via Scroogle (www.scroogle.org)
slashdot -- Search stories on Slashdot (www.slashdot.org)
slinuxdoc -- Search entries in LDP (www.linuxdoc.org)
sourceforge -- Search SourceForge (www.sourceforge.net)
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index 321f8f9..43efa99 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -39,6 +39,7 @@ dist_elvi_SCRIPTS = \
deja \
discogs \
dmoz \
+ duckduckgo \
ebay \
etym \
excite \
@@ -60,8 +61,6 @@ dist_elvi_SCRIPTS = \
imdb \
ixquick \
javasun \
- scpan \
- slinuxdoc \
l1sp \
lastfm \
leodict \
@@ -83,7 +82,10 @@ dist_elvi_SCRIPTS = \
rpmsearch \
scholar \
scicom \
+ scpan \
+ scroogle \
slashdot \
+ slinuxdoc \
sourceforge \
springer \
stockquote \
diff --git a/elvi/duckduckgo b/elvi/duckduckgo
new file mode 100755
index 0000000..85e41a1
--- /dev/null
+++ b/elvi/duckduckgo
@@ -0,0 +1,60 @@
+#!/bin/sh
+# elvis: duckduckgo -- Search the web using Duckduckgo (www.duckduckgo.com)
+# ianb at erislabs.net 20100416
+. surfraw || exit 1
+
+w3_config_hook () {
+ def SURFRAW_duckduckgo_search ""
+ defyn SURFRAW_duckduckgo_lucky 0
+}
+
+w3_usage_hook () {
+ cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+ Surfraw search the web using Duckduckgo (duckduckgo.com)
+ Requires Javascript
+Local options:
+ -l, -lucky, -d, -ducky Feeling d^Hlucky? Jump to first result.
+ -search= Search type
+ info | Information
+ shopping | Shopping
+ Environment: SURFRAW_duckduckgo_search
+ Default is neither, use normal search.
+EOF
+ w3_global_usage
+}
+
+w3_parse_option_hook () {
+ opt="$1"
+ optarg="$2"
+ case "$opt" in
+ -search=*) setopt SURFRAW_duckduckgo_search "$optarg" ;;
+ -[ld]*) setoptyn SURFRAW_duckduckgo_lucky 1 ;;
+ *) return 1 ;;
+ esac
+ return 0
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+
+if test -z "$w3_args"; then
+ w3_browse_url "http://duckduckgo.com/"
+else
+ escaped_args=`w3_url_of_arg $w3_args`
+ url="http://duckduckgo.com/?q=${escaped_args}"
+ # -lucky & -search= are mutually exclusive - prefer -lucky
+ if ifyes SURFRAW_duckduckgo_lucky; then
+ url="${url}&v=i"
+ elif test -n "$SURFRAW_duckduckgo_search"; then
+ case "$SURFRAW_duckduckgo_search" in
+ i*) url="${url}&v=d" ;;
+ s*) url="${url}&v=s" ;;
+ *) err "duckduckgo: unknown search type \"${SURFRAW_duckduckgo_search}\"" ;;
+ esac
+ fi
+
+ w3_browse_url "$url"
+fi
diff --git a/elvi/scroogle b/elvi/scroogle
new file mode 100755
index 0000000..447f77a
--- /dev/null
+++ b/elvi/scroogle
@@ -0,0 +1,124 @@
+#!/bin/sh
+# elvis: scroogle -- Search Google anonymously via Scroogle (www.scroogle.org)
+# ianb at erislabs.net 20100416
+. surfraw || exit 1
+
+w3_config_hook () {
+ def SURFRAW_scroogle_results 20
+ defyn SURFRAW_scroogle_ssl yes
+ def SURFRAW_scroogle_lang "$SURFRAW_lang"
+ # number in URL of language pages
+ def SURFRAW_scroogle_langpagever 8
+}
+
+w3_usage_hook () {
+ cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+ Search Google anonymously using Scroogle (www.scroogle.org)
+Local options:
+ -nossl Don't use https
+ -results=NUM Number of search results returned
+ Default: $SURFRAW_scroogle_results
+ Environment: SURFRAW_scroogle_results
+ -lang= Search for pages written in LANG.
+ al | any language (default)
+ ar | Arabic
+ zs | Chinese (simplified)
+ zt | Chinese (traditional)
+ cs | Czech
+ da | Danish
+ nl | Dutch
+ en | English
+ et | Estonian
+ fi | Finnish
+ fr | French
+ de | German
+ el | Greek
+ iw | Hebrew
+ hu | Hungarian
+ is | Icelandic
+ it | Italian
+ ja | Japanese
+ ko | Korean
+ lv | Latvian
+ lt | Lithuanian
+ no | Norwegian
+ pt | Portuguese
+ pl | Polish
+ ro | Romanian
+ ru | Russian
+ es | Spanish
+ sv | Swedish
+ tr | Turkish
+EOF
+ w3_global_usage
+}
+
+w3_parse_option_hook () {
+ opt="$1"
+ optarg="$2"
+ case "$opt" in
+ -results=*) setopt SURFRAW_scroogle_results "$optarg" ;;
+ -lang=*) setopt SURFRAW_scroogle_lang "$optarg" ;;
+ -no*) setoptyn SURFRAW_scroogle_ssl no ;;
+ *) return 1 ;;
+ esac
+ return 0
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+
+if ifno SURFRAW_scroogle_ssl; then
+ base="http://www.scroogle.org"
+ path="cgi-bin/nbbw.cgi"
+else
+ base="https://ssl.scroogle.org"
+ path="cgi-bin/nbbwssl.cgi"
+fi
+
+case "$SURFRAW_scroogle_lang" in
+ al|ar|zs|zt|cs|da|nl|en|et|fi|fr|de|el|iw|hu|is|it|ja|ko|lv|lt|no|\
+ pt|pl|ro|ru|es|sv|tr) lang="${SURFRAW_scroogle_lang}" ;;
+ *) lang="";
+esac
+
+if test -z "$w3_args"; then
+# urls of search page:
+# http://www.scroogle.org/cgi-bin/scraper.htm
+# http://www.scroogle.org/scrap${SURFRAW_scroogle_lang}${SURFRAW_scroogle_langpagever}.html
+# https://ssl.scroogle.org/
+# https://ssl.scroogle.org/scrap${SURFRAW_scroogle_lang}${SURFRAW_scroogle_langpagever}.html
+ url="${base}"
+ if ifno SURFRAW_scroogle_ssl; then
+ file="cgi-bin/scraper.htm"
+ else
+ file=""
+ fi
+ if test -n "$lang";then
+ url="${url}/scrap${lang}${SURFRAW_scroogle_langpagever}.html"
+ else
+ url="${url}/${file}"
+ fi
+else
+ case "$SURFRAW_scroogle_results" in
+ 50) results=5 ;;
+ 100) results=1 ;;
+ *) results=2 ;; # default = 2 == 20 results
+ esac
+
+ urlopts="n=${results}"
+
+ if test -n "$lang";then
+ urlopts="${urlopts}&l=${lang}"
+ fi
+
+ escaped_args=`w3_url_of_arg $w3_args`
+ # Gw must come first
+ url="${base}/${path}?Gw=${escaped_args}&${urlopts}"
+fi
+
+w3_browse_url "$url"
+
diff --git a/links.IN b/links.IN
index 5bb71d0..ba7f0ef 100644
--- a/links.IN
+++ b/links.IN
@@ -35,6 +35,7 @@ elvi.1sr.gz @mandir@/man1/debwiki.1sr.gz
elvi.1sr.gz @mandir@/man1/deja.1sr.gz
elvi.1sr.gz @mandir@/man1/discogs.1sr.gz
elvi.1sr.gz @mandir@/man1/dmoz.1sr.gz
+elvi.1sr.gz @mandir@/man1/duckduckgo.1sr.gz
elvi.1sr.gz @mandir@/man1/ebay.1sr.gz
elvi.1sr.gz @mandir@/man1/etym.1sr.gz
elvi.1sr.gz @mandir@/man1/excite.1sr.gz
@@ -78,6 +79,7 @@ elvi.1sr.gz @mandir@/man1/rpmsearch.1sr.gz
elvi.1sr.gz @mandir@/man1/scholar.1sr.gz
elvi.1sr.gz @mandir@/man1/scicom.1sr.gz
elvi.1sr.gz @mandir@/man1/scpan.1sr.gz
+elvi.1sr.gz @mandir@/man1/scroogle.1sr.gz
elvi.1sr.gz @mandir@/man1/slashdot.1sr.gz
elvi.1sr.gz @mandir@/man1/slinuxdoc.1sr.gz
elvi.1sr.gz @mandir@/man1/sourceforge.1sr.gz
diff --git a/test/duckduckgo.test b/test/duckduckgo.test
new file mode 100644
index 0000000..580e360
--- /dev/null
+++ b/test/duckduckgo.test
@@ -0,0 +1,3 @@
+duckduckgo foo
+foobar
+
diff --git a/test/scroogle.test b/test/scroogle.test
new file mode 100644
index 0000000..25d713e
--- /dev/null
+++ b/test/scroogle.test
@@ -0,0 +1,6 @@
+scroogle surfraw
+fast unix command line interface
+scroogle -nossl surfraw
+fast unix command line interface
+scroogle -lang=en surfraw
+fast unix command line interface
--
surfraw - a fast unix command line interface to WWW
More information about the Surfraw-commits
mailing list