photo
Jordan Sissel
geek

Sat, 23 Jun 2007

jquerycmd+xpathtool == direction scraping on google

Show the first 3 steps that google maps tells you to take.
./getpath.sh "atlanta to nyc" | head -3
Head southeast on Trinity Ave SW toward Washington St SW        0.2mi
Slight left at Memorial Dr SW   0.3mi
Turn left at Martin St SE       361ft
Pipe that to lpr and you've got printed directions on under 5 seconds.

Why not just do this with plain page scraping? Because there's lots of javascript in google maps that presents the user with the directions. Firefox (Gecko, really) already parses it, so why bother reinventing the wheel? Let's use the wheel that already works.

Download jquery-20070623.1828.tar.gz. The download of jquerycmd comes with the xul app, 'jquerycmd.sh' and 'getpath.sh'.

For the lazy who just want to see the scripts:

Comments: 0 (view comments)
Tags: , , , , ,
Permalink: /geekery/superhappydevhouse18-part2
posted at: 21:16

At SuperHappyDevHouse 18

I've been working on the jquery commandline tool. The base features work, now all that remains is endlessly interating over adding features.
% ./jquerycmd.sh --url http://www.google.com --query img
<IMG width='276' height='110' src='/intl/en_ALL/images/logo.gif' alt='Google' />
% ./jquerycmd.sh --url http://www.technorati.com/ --query form
<FORM method='post' action='/query.php'>
        <div class="controls">
            <a href="/search?advanced">advanced search</a>
        </div>
... < remainder cut > ...

Comments: 0 (view comments)
Tags: , , ,
Permalink: /geekery/superhappydevhouse18-part1
posted at: 20:23

Search this site

Navigation

Metadata

Home About Resume My Code

Articles

ARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work Efficiency

Projects

fex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scripts

Presentations

Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials

Tag Cloud

Calendar

< June 2007 >
SuMoTuWeThFrSa
      1 2
3 4 5 6 7 8 9
10111213141516
17181920212223
24252627282930

Friends

BarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler Shields

Technorati