Serchilo on your console
September 15, 2008
We’ve implemented a little new interface for all console lovers. By calling Serchilo with action=url, for instance:
http://serchilo.net/?action=url&query=g+berlin
you will not be redirected to the target site but will just get its URL:
http://www.google.com/search?hl=en&q=berlin&ie=utf-8
This can be very useful if you have a shell script on your system calling Serchilo with your query, getting the url, downloading the target page and filtering it through html2text.
If this script is called “s” and is located in a directory of $PATH and you’ve installed html2text you can do this:
$ s dbt berlin, hamburg | html2text
===============================================================================
****** Fahrplanauskunft ?bersicht ******
[frühere Verbindungen]
+-------------------------+---------------------+----+--------+--------+
| Bahnhof ab | Bahnhof an | Um | Ab | An |
+-------------------------+---------------------+----+--------+--------+
| 1. Berlin Hbf (tief) | Hamburg Hbf | 0 | 05:18 | 07:07 |
| 2. Berlin Hbf (tief) | Hamburg Hbf | 0 | 05:58 | 07:46 |
| 3. Berlin Hbf (tief) | Hamburg Hbf | 0 | 07:18 | 08:57 |
+-------------------------+---------------------+----+--------+--------+
[spätere Verbindungen]
Anzeigeformen
[Detail]
[Reisebegleiter]
Verweise
Neue Anfrage
Zur Hauptseite der Deutschen Bahn AG
===============================================================================
Software/Datenstand: HAFAS 5.23.DB.R5.50.c - 15.09.08
Alle Angaben ohne Gew?hr, bei Gleisangaben beachten Sie bitte die ?rtlichen
Hinweise. Hier erreichen Sie uns bei Problemen.
Here’s the script, enjoy!
#!/bin/sh SERCHILOQUERY="http://serchilo.net/?action=url&query=$@" URL=`wget -qO - "$SERCHILOQUERY"` if [ -n "$URL" ] then wget -U "Firefox" -qO - "$URL" fi
Entry Filed under: Uncategorized. .
2 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1.
ke | September 16, 2008 at 7:45 am
Great idea, thanks a lot!
2.
dagobart | February 14, 2009 at 4:50 am
Great, that was just what I was looking for. I’d like to build a Twitter bot for serchilo searches, so it’d be possible to look up the next train while your on the “road” (due to Twitter–mobile integration).