Serchilo on your console

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
Advertisements

3 thoughts on “Serchilo on your console

  1. 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).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s