Show HN: Terminal Based Wikipedia
github.com
github.com
cat /bin/wik
#!/bin/sh
lynx https://en.wikipedia.org/w/index.php?search=$1The mobile site, https://en.m.wikipedia.org/ , looks a little better in them.
cat `which ddg`
#!/usr/bin/env sh
w3m 'https://duckduckgo.com/?q='`echo $@ | sed 's/ /\+/g'`But,there are already browsers and web guidelines to make this possible without specific single purpose apps.
Why would I use this over for example, Lynx?
$ alias wiki='f(){ w3m -F "https://en.wikipedia.org/w/index.php?search=${1}&title=Special:Search&ns0=1"; unset -f f; }; f'
$ wiki pandas
This seemed to work well for me.A tab to the wikipedia search page bookmarked would work well too and could be used in existing w3m/lynx session.
$ alias crate='f(){ w3m -F "https://lib.rs/search?q=${1}"; unset -f f; }; f'
$ crate rocket
(lib.rs is a crate index using rust as the server instead of javascript, and has advantage of working well with terminal browsers)Aside from that, no benefit really that I can think of.
So yes, to be clear to anyone else you can just put:
wiki(){ w3m -F "https://en.wikipedia.org/w/index.php?search=${1}&title=Special:Search&ns0=1"; }
in your .bashrc - and if you're me you just forget how you defined it and you have to cat it every once in a while :)Oh, and you might be entertained by this silly alias adapted from an IOCC entry...
$ cstdin
printf("Hello World\n");
Hello World
alias cstdin='gcc -pedantic -ansi -Wall -o ~/.stdin ~/.stdin.c -lm && ~/.stdin'
$ cat ~/.stdin.cc
#include <stdio.h>
<snip many headers>
int main(int argc, char **argv)
{
#include </dev/tty>
return 0;
}
I'm sure it would also make way more sense as a dedicated script. I have a C++ one in there too.https://en.wikipedia.org/wiki/Wikipedia:Wikipedia_Signpost/2...
1. I'm not sure what's the difference between -i and -s, they seem to work the same for a few examples I tried
2. It renders every paragraph in a different color, which seems... unnecessary
3. There's a [-] at the beginning of every paragraph which I'm not sure what it is for (seems to suggest that it is to fold the paragraph but I don't really see how to actually fold it).
The only real improvement is speed at the cost of memorizing a new key stroke interface for every app. Every other aspect of terminal interfaces is a downgrade. The cost of memorization is also a huge burden
I feel there's got to be a better way that gets the best of both worlds.
Even if you found a better way, the world might just end up with yet another set of keystrokes to memorize.
Really? Seriously? No better way to query the source of a page and render it on the terminal?
See also:
* https://github.com/spencermountain/wtf_wikipedia#ok-first-
* https://osr.cs.fau.de/wp-content/uploads/2017/09/wikitext-pa...
* https://utcc.utoronto.ca/~cks/space/blog/programming/Parsing...
Much worse than I thought.
If only if mediawiki (php) never happened. Wikipedia was sane at one point.
Is this scraping the HTML pages, or fetching the wikitext through the API and rendering it?
https://github.com/yashsinghcodes/wik/blob/main/wik/info.py#...