Google Suche
Übersicht

![]() |
blitzuser34Betreff: Google Suche |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi,
hab folgenden Code: Code: [AUSKLAPPEN] window=Centerwindow("Google",1024,768)
textfeld=CreateTextArea(5,5,1024-15,(768-35)/2-5,window) Global response$="" listbox=CreateListBox(5,5+(768-35)/2,1024-15,(768-35)/2,window) suchwort$="BlitzForum" google=OpenTCPStream("www.google.de",80) If google=0 Then RuntimeError "Google gibt's nicht!!!" WriteLine google,"Get http://www.google.de/search?as_q="+suchwort$+"&hl=de&num=100&btnG=Google-Suche&as_epq=&as_oq=&as_eq=&lr=&cr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=&as_rights=&safe=images HTTP/1.0" WriteLine google,"host: www.google.de" WriteLine google,"" While Not Eof(google) response$=response$+ReadLine(google) response$=response$+Chr(10) Wend linkpos=0 lastpos=0 linkendpos=0 Repeat linkpos=Instr(response$,"<a href",lastpos) If linkpos=0 Then Exit linkendpos=Instr(response$,Chr(34),linkpos+9) link$=Mid(response$,linkpos+9,linkendpos-linkpos-9) If Instr(link$,".google.") Or Left(link$,1)="/" Or Instr(link$,"youtube") Then Goto googlelink AddGadgetItem listbox,link$ .googlelink lastpos=linkendpos+1 Forever SetGadgetText textfeld,response$ Repeat event=WaitEvent() If event=$803 Then End ElseIf event=$401 source=EventSource() If source=listbox Then evdat=EventData() ExecFile GadgetItemText$(listbox,evdat) EndIf EndIf Forever Function CenterWindow (title$, width, height, group = 0, style = 1) Return CreateWindow (title$, (ClientWidth (Desktop ()) / 2) - (width / 2), (ClientHeight (Desktop ()) / 2) - (height / 2), width, height, group, style) End Function Allerdings dauert der Verbindungsaufbau mit TCP ziemlich lange. Wollte mal fragen ob jemand ne schnellere Methode weiß. BlitzUser34 |
||
- Zuletzt bearbeitet von blitzuser34 am So, Jul 27, 2008 14:55, insgesamt einmal bearbeitet
ChristianK |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich weiss zwar nicht warum, aber HTTP/1.0 geht schneller als HTTP/1.1 ![]() |
||
AdvanceLcd
Intel Core 2 Duo 3.2 GHz, 4 GB RAM, GeForce 8800 GTX | MacBook Pro 15,4″ Intel Core 2 Duo 2.4 GHz, 2 GB RAM, GeForce 8600M GT |
![]() |
blitzuser34Betreff: Eindeutig schneller |
![]() Antworten mit Zitat ![]() |
---|---|---|
Stimmt! Statt ca. 9 braucht es nur noch ca. 2 Sekunden ![]() |
||
E. Urbachehemals "Basicprogger" |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Habe den Code nicht getestet, aber ReadLine() solltest du unbedingt mit einem anderen Befehl austauschen, der mehr Bytes auf einmal liest.
Das kann zumindest bei BMax und anderen Programmiersprachen die Geschwindigkeit stark verbessern. Es ist lange her, dass ich Netzwerk-Programme in BB erstellt habe, aber afaik sollte CopyStream (Standard-Buffergröße: 16384) die schnellste Methode sein. |
||
The box said, "Requires Windows XP or better", so I installed Ubuntu | Linux is NOT Windows
Flua :: Profiler für BB und BMax :: Partikel-Engine für BMax :: Lyphia-Projekt Quellcode (BMax) :: Automatische Parallelisierung :: Meine Musik |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group