Yahoo! search interface: Difference between revisions

+ AutoHotkey
m (→‎{{header|Tcl}}: link to tcllib library)
(+ AutoHotkey)
Line 3:
Create a class for searching Yahoo results.
It must implement a '''Next Page''' method, and read URL, Title and Content from results.
=={{header|AutoHotkey}}==
translated from python example
<lang AutoHotkey>
yahooSearch("test", 1)
yahooSearch("test", 2)
 
yahooSearch(query, page)
{
global
start := ((page - 1) * 10) + 1
filedelete, search.txt
urldownloadtofile, % "http://search.yahoo.com/search?p=%" . query
. "&b=%" . start, search.txt
fileread, content, search.txt
reg = <a class="yschttl spt" href=".+?" >(.+?)</a></h3></div><div class="abstr">(.+?)</div><span class=url>(.+?)</span>
index := found := 1
while (found := regexmatch(content, reg, self, found + 1))
{
msgbox % title%A_Index% := fix(self1)
content%A_Index% := fix(self2)
url%A_Index% := fix(self3)
}
}
 
 
fix(url)
{
stringreplace, url, url, <b>, ,All
stringreplace, url, url, </b>, ,All
stringreplace, url, url, <wbr />, ,All
stringreplace, url, url, <wbr>, ,All
stringreplace, url, url, <b>...</b>, ,All
if pos := instr(url, "</a></h3></div>")
StringLeft, url, url, pos
return url
}
</lang>
=={{header|C sharp|C#}}==
 
Anonymous user