This one returns a random article from Wikipedia FR.
It has some bugs, because of html chars and simplicity…
but at least it’s fast and reliable.

user@computer:$ curl -s "http://fr.wikipedia.org/w/index.php?title=`curl -s -L "http://fr.wikipedia.org/wiki/Sp%C3%A9cial:Page_au_hasard" | grep "<title>" | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed 's/ - Wikipédia//g' | sed -e 's/^[ \t]*//' | sed 's/ /_/g'`&printable=yes" | grep "<p>" | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'

http://fr.wikipedia.org/wiki/Sp%C3%A9cial:Page_au_hasard > is a random page redirector from wikipedia
-L option in curl allows redirection from there. (Location)
then we get the title of page, replace spaces with underscores and finally get a printable URL.
after that we keep only “<p>” lines (usually text in wikipedia)

Again it’s not perfect. feel free to make it better and post it back here ;)




If you like my work,
please consider
a donation ;)




WP Comments:
Forum: 0 Comments +
SOCIAL



Comments are closed.