| |
|
|
| googleAjaxSearchResultsToList Google cherche Ergebnisse
Herunterladen
KompilierenMarqueSéparation {$cleq}
{$compiler c:\dev\xprofan11\11}
{$runtime c:\dev\xprofan11\11}
string s=input$("Suche:","Suche:","XProfan")
case s=="" : end
clearList
googleAjaxSearchResultsToList(s)
listbox$("Ergebnisse:",1)
end
googleAjaxSearchResultsToList(string src){
downloadFile("https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+urlEncode(src))
while %Loading{sleep 100}
strings a
a=explode($download,"\qGsearchResultClass\q")
long c=sizeOf(a),d
whileloop 0,c-1 {
src=substr$(substr$(a[loop],2,"\qunescapedUrl\q:\q"),1,"\q")
casenot src=="" : addString src
d+
}
return d
}
Proc urlEncode
Parameters String$
Declare I&,Char%,Urlpathencode$
Urlpathencode$ = String$
declare Urlencode$
Whileloop Len(Urlpathencode$),1,-1
Char% = Ord(Mid$(Urlpathencode$,&Loop,1))
If ((Char%>96) And (Char%<123))
Elseif ((Char%>47) And (Char%<58))
Elseif ((Char%>64) And (Char%<91))
Elseif ((Char%>44) And (Char%<48))
Elseif (Char% = 95)
Elseif (Char% = 126)
Elseif (Char% = 38)
Elseif (Char% = 58)
Elseif (Char% = 63)
Elseif (Char% = 64)
Elseif (Char% = 35)
Elseif (Char% = 33)
Elseif (Char% = 36)
Elseif (Char% = 42)
Elseif (Char% = 43)
Else
If (&Loop=1)
Urlencode$ = "%" + Hexx(Char%) + Mid$(Urlencode$,&Loop+1,Len(Urlencode$))
Elseif (&Loop=Len(Urlencode$))
Urlencode$ = Left$(Urlencode$,&Loop-1) + "%" + Hexx(Char%)
Else
Urlencode$ = Left$(Urlencode$,&Loop-1) + "%" + Hexx(Char%) + Mid$(Urlencode$,&Loop+1,Len(Urlencode$))
Endif
Endif
Wend
Return Urlpathencode$
Endproc
Proc Hexx
Parameters Zahl&
If (Zahl&>15)
Return Hex$(Zahl&)
Else
Return "0"+Hex$(Zahl&)
Endif
ENDPROC
|
|
|
| |
|
|