Yahoo! search interface: Difference between revisions
Content added Content deleted
Line 978: | Line 978: | ||
=={{header|TXR}}== |
=={{header|TXR}}== |
||
The following gives us a shell utility which we can invoke with arguments like "rosetta 0" to get the first page of search results for "rosetta". |
|||
The two arguments are handled as if they were two lines of text from a data source using @(next :args). We throw an exception if there is no match (insufficient arguments are supplied). |
|||
A little sprinkling of regex is used. |
|||
<lang txr>#!/usr//bin/txr -f |
|||
@(next :args) |
|||
@(cases) |
|||
@ QUERY |
|||
@ PAGE |
|||
@(or) |
|||
@ (throw error "specify query and page# (from zero)") |
|||
@(end) |
|||
@(next `!wget -O - http://search.yahoo.com/search?p=@QUERY\&b=@{PAGE}1 2> /dev/null`) |
|||
@(all) |
|||
@ (coll)<a class="yschttl spt" href="@URL" @/[^>]+/>@TITLE</a>@(end) |
|||
@(and) |
|||
@ (coll)<div class="@/abstr|sm-abs/">@ABSTR</div>@(end) |
|||
@(end) |
|||
@(output) |
|||
@ (repeat) |
|||
TITLE: @TITLE |
|||
URL: @URL |
|||
TEXT: @ABSTR |
|||
--- |
|||
@ (end) |
|||
@(end) |
|||
</lang> |
|||
Sample run: |
|||
<pre>$ ./yahoosearch.txr rosetta 0 |
|||
TITLE: <b>Rosetta</b> | Partner With Our Interactive <wbr />Marketing Agency Today |
|||
URL: http://www.rosetta.com/Pages/default.aspx |
|||
TEXT: Learn about the fastest growing interactive marketing agency in the country - <b>Rosetta</b>. Our strategic marketing planning is custom built and connects you with your ... |
|||
--- |
|||
TITLE: Official <b>Rosetta</b> Stone® - Learn a <wbr />Language Online - Language ... |
|||
URL: http://www.rosettastone.com/ |
|||
TEXT: <b>Rosetta</b> Stone is the world's #1 language-learning software. Our comprehensive foreign language program provides language learning for individuals and language learning ... |
|||
--- |
|||
TITLE: <b>Rosetta</b> (software) - Wikipedia, the <wbr />free encyclopedia |
|||
URL: http://en.wikipedia.org/wiki/Rosetta_(software) |
|||
TEXT: Rosettais a lightweight dynamic translatorfor Mac OS Xdistributed by Apple. It enabled applications compiled for the PowerPCfamily of processors to run on Apple systems that use... |
|||
--- |
|||
TITLE: <b>Rosetta</b> (spacecraft) - Wikipedia, the <wbr />free encyclopedia |
|||
URL: http://en.wikipedia.org/wiki/Rosetta_space_probe |
|||
TEXT: Rosettais a robotic spacecraftof the European Space Agencyon a mission to study the comet 67P/ChuryumovâGerasimenko. <b>Rosetta </b>consists of two main elements: the <b>Rosetta </b>space probeand... |
|||
--- |
|||
TITLE: Apple - Mac |
|||
URL: http://www.apple.com/mac/ |
|||
TEXT: Discover the world of Mac. Check out MacBook, iMac, iLife, and more. Download QuickTime, Safari, and widgets for free. |
|||
--- |
|||
TITLE: <b>Rosetta</b> | Free Music, Tour Dates, <wbr />Photos, Videos |
|||
URL: http://www.myspace.com/rosetta |
|||
TEXT: <b>Rosetta</b>'s official profile including the latest music, albums, songs, music videos and more updates. |
|||
--- |
|||
TITLE: <b>Rosetta</b> |
|||
URL: http://rosettaband.com/ |
|||
TEXT: Metal for astronauts. Philadelphia, since 2003. Contact us at rosettaband@gmail.com Twitter | Facebook |
|||
--- |
|||
TITLE: <b>Rosetta</b> |
|||
URL: http://rosetta.jpl.nasa.gov/ |
|||
TEXT: The <b>Rosetta</b> spacecraft is on its way to catch and land a robot on a comet! <b>Rosetta</b> will reach comet '67P/Churyumov-Gerasimenko' ('C-G') in 2014. The European Space Agency ... |
|||
--- |
|||
TITLE: <b>Rosetta</b> : Multi-script Typography |
|||
URL: http://rosettatype.com/ |
|||
TEXT: <b>Rosetta</b> is a new independent foundry with a strong focus on multi-script typography. We are committed to promote research and knowledge in that area and to support ... |
|||
--- |
|||
TITLE: <b>Rosetta</b> (1999) - IMDb |
|||
URL: http://www.imdb.com/title/tt0200071/ |
|||
TEXT: With Ãmilie Dequenne, Fabrizio Rongione, Anne Yernaux, Olivier Gourmet. Young and impulsive <b>Rosetta</b> lives with her alcoholic mother and, moved by despair, she will ... |
|||
--- |
|||
</pre> |
|||
{{omit from|Batch File|Does not have network access.}} |
{{omit from|Batch File|Does not have network access.}} |