![]() |
Google Suchergebnisse abfragen
Hallo
Ist es möglich mit delphi bei einer google suche z.B: immer das erste Ergebniss abzufragen? Warum? Ich will mir mit Delphi ein Programm schreiben das mir den Segelflugbericht von DWD abruft. Leider wechseln die regelmäßig die URL vom Wetterbericht um zu verhindern das jemand ihn auf seiner Website veröffentlicht. |
AW: Google Suchergebnisse abfragen
Wenn ich auf google Segelflugwetter Stuttgart eingebe ist das erste Ergebnis das richtige wenn ich jetzt einmal auf tab drücke und anschließend auf enter wir es geöffnet vielleicht kann man das mit Delphi simulieren?
|
AW: Google Suchergebnisse abfragen
Hat dir hier schon mal jemand gesagt, dass das hier ein Forum und kein Blog ist? :gruebel:
Das Pushen der eigenen Beiträge innerhalb von 24h wird hier nicht so gerne gesehen (siehe Forenregeln) (Wenn du noch etwas vergessen hast, dann kannst du deinen Beitrag 24h lang bearbeiten) Zur Frage: Es gibt da einen Delphi JSON Parser und dort gibt es ein Beispiel, wie man die Google-Suche direkt anzapft und mit diesem Parser auch verarbeitet |
AW: Google Suchergebnisse abfragen
Zitat:
Aus dem Beispiel kapier ich nicht so viel. Gibt es irgentwo ein Code mit Beschreibung oder erklärung? |
AW: Google Suchergebnisse abfragen
Delphi-Quellcode:
Den Rest solltest du mit dem Debugger und der Doku herausbekommen
// Callback Procedure (siehe superobject.pas Zeile 164)
procedure response(const This, Params: ISuperObject; var Result: ISuperObject); var obj: ISuperObject; begin with SearchForm.ResultList.Items do begin BeginUpdate; try Clear; case Params.I['responseStatus'] of 200: for obj in Params['responseData.results'] do Add(obj.Format('%visibleUrl% - (%unescapedUrl%)')); else Add(Params.S['responseDetails']); end; finally EndUpdate; end; end; end; procedure TSearchForm.goClick(Sender: TObject); var req: IXMLHttpRequest; o: ISuperObject; begin req := {$IFDEF VER210}CoXMLHTTP{$ELSE}CoXMLHTTPRequest{$ENDIF}.Create; // Suche bei Google (callback=response) // Rückgabe ist "response(<JSON-Objekt mit den Suchergebnissen>)" req.open('GET', 'http://www.google.com/uds/GwebSearch?callback=response&rsz=large&v=1.0&q='+ UTF8Encode(GSearch.Text), false, EmptyParam, EmptyParam); req.send(EmptyParam); // leeres Objekt erzeugen o := so; // Callback Prozedur zuweisen o.M['response'] := response; // Da der zurückgelieferte Wert so aussieht "response(...)" und das Objekt eine Methode "response" kennt // wird diese Methode und damit die Callback-Prozedur ausgeführt o[req.responseText]; end; Schau dir auf jeden Fall mal den Wert von
Delphi-Quellcode:
im Debugger an.
req.responseText
Suche nach "Delphi"
Code:
response({
"responseData":{ "results":[ { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://delphi.com/", "url":"http://delphi.com/", "visibleUrl":"delphi.com", "cacheUrl":"http://www.google.com/search?q\u003dcache:BD49F_np05UJ:delphi.com", "title":"\u003cb\u003eDelphi\u003c/b\u003e is a leading global supplier of electronics and technologies \u003cb\u003e...\u003c/b\u003e", "titleNoFormatting":"Delphi is a leading global supplier of electronics and technologies ...", "content":"Operating major technical centers, manufacturing sites and customer supportfacilities in 30 countries, \u003cb\u003eDelphi\u003c/b\u003e delivers real-world innovations that make products \u003cb\u003e...\u003c/b\u003e" }, { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://en.wikipedia.org/wiki/Delphi", "url":"http://en.wikipedia.org/wiki/Delphi", "visibleUrl":"en.wikipedia.org", "cacheUrl":"http://www.google.com/search?q\u003dcache:p7yTAyPO4zgJ:en.wikipedia.org", "title":"\u003cb\u003eDelphi\u003c/b\u003e - Wikipedia, the free encyclopedia", "titleNoFormatting":"Delphi - Wikipedia, the free encyclopedia", "content":"\u003cb\u003eDelphi\u003c/b\u003e 1] is both an archaeological site and a modern town inGreece on the south-western spur of Mount Parnassus in the valley of Phocis. \u003cb\u003eDelphi\u003c/b\u003e was the site \u003cb\u003e...\u003c/b\u003e" }, { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://www.embarcadero.com/products/delphi", "url":"http://www.embarcadero.com/products/delphi", "visibleUrl":"www.embarcadero.com", "cacheUrl":"http://www.google.com/search?q\u003dcache:qhbs64-Zd6MJ:www.embarcadero.com", "title":"\u003cb\u003eDelphi\u003c/b\u003e XE4 | Develop Apps for iOS, Windows and Mac", "titleNoFormatting":"Delphi XE4 | DevelopApps for iOS, Windows and Mac", "content":"\u003cb\u003eDelphi\u003c/b\u003e XE4- the multi-device, true native app development solution for iOS, Windows andMac." }, { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://www.delphiforums.com/", "url":"http://www.delphiforums.com/", "visibleUrl":"www.delphiforums.com", "cacheUrl":"http://www.google.com/search?q\u003dcache:i-8mt-uNXBMJ:www.delphiforums.com", "title":"\u003cb\u003eDelphi\u003c/b\u003e Forums: Communities for friends, groups and businesses", "titleNoFormatting":"Delphi Forums: Communities for friends, groups and businesses", "content":"Create your free forum on \u003cb\u003eDelphi\u003c/b\u003e Forums, the leading network of user-created, user-managed communities for groups, organizations, businesses, and people \u003cb\u003e...\u003c/b\u003e" }, { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://www.ancient-greece.org/archaeology/delphi-archaeology.html", "url":"http://www.ancient-greece.org/archaeology/delphi-archaeology.html", "visibleUrl":"www.ancient-greece.org", "cacheUrl":"http://www.google.com/search?q\u003dcache:F1tBLROtmA0J:www.ancient-greece.org", "title":"\u003cb\u003eDelphi\u003c/b\u003e - Ancient-Greece.org", "titleNoFormatting":"Delphi - Ancient-Greece.org", "content":"The archaeological site of \u003cb\u003eDelphi\u003c/b\u003e is one of the most important ancient relics of Greece. The magnitude of the \u003cb\u003eDelphi\u003c/b\u003e contributions to the entire ancient civilization \u003cb\u003e...\u003c/b\u003e" }, { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://www.delphiglass.com/", "url":"http://www.delphiglass.com/", "visibleUrl":"www.delphiglass.com", "cacheUrl":"http://www.google.com/search?q\u003dcache:eggE6s9go-oJ:www.delphiglass.com", "title":"Stained Glass Supplies, Fusing Supplies At \u003cb\u003eDelphi\u003c/b\u003e Glass", "titleNoFormatting":"Stained Glass Supplies, Fusing Supplies At Delphi Glass", "content":"Stained Glass Supplies, Fusing Supplies, Flameworking \u0026amp; More at \u003cb\u003eDelphi\u003c/b\u003e Glass." }, { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://delphi.about.com/", "url":"http://delphi.about.com/", "visibleUrl":"delphi.about.com", "cacheUrl":"http://www.google.com/search?q\u003dcache:rbXWRXtYbK8J:delphi.about.com", "title":"About \u003cb\u003eDelphi\u003c/b\u003e Programming - For Novice and Expert Embarcadero \u003cb\u003e...\u003c/b\u003e", "titleNoFormatting":"About Delphi Programming - For Novice and Expert Embarcadero ...", "content":"Jan 3, 2013 \u003cb\u003e...\u003c/b\u003e Are you a beginner or expert \u003cb\u003eDelphi\u003c/b\u003e developer? Looking for how to get started or need advice and help for a quick solution to your daily \u003cb\u003eDelphi\u003c/b\u003e \u003cb\u003e...\u003c/b\u003e" }, { "GsearchResultClass":"GwebSearch", "unescapedUrl":"http://www.cityofdelphi.org/", "url":"http://www.cityofdelphi.org/", "visibleUrl":"www.cityofdelphi.org", "cacheUrl":"http://www.google.com/search?q\u003dcache:vcmJ8nlpArEJ:www.cityofdelphi.org", "title":"City of \u003cb\u003eDelphi\u003c/b\u003e - Welcome to the City of \u003cb\u003eDelphi\u003c/b\u003e!", "titleNoFormatting":"City of Delphi - Welcome to the City of Delphi!", "content":"Welcome to the City of \u003cb\u003eDelphi\u003c/b\u003e, Indiana. \u003cb\u003eDelphi\u003c/b\u003e was chosen as a stellar community in 2012. Explore our storied past and stellar future." } ], "cursor":{ "resultCount":"9,610,000", "pages":[ { "start":"0", "label":1 }, { "start":"8", "label":2 }, { "start":"16", "label":3 }, { "start":"24", "label":4 }, { "start":"32", "label":5 }, { "start":"40", "label":6 }, { "start":"48", "label":7 }, { "start":"56", "label":8 } ], "estimatedResultCount":"9610000", "currentPageIndex":0, "moreResultsUrl":"http://www.google.com/search?oe\u003dutf8\u0026ie\u003dutf8\u0026source\u003duds\u0026start\u003d0\u0026hl\u003den\u0026q\u003dDelphi", "searchResultTime":"0.24" } }, "responseDetails":null, "responseStatus":200 }) |
AW: Google Suchergebnisse abfragen
Vielleicht etwas Offtopic, aber trotzdem:
Mich interessieren die DWD-Wetterbilder, z.B. von ![]() Auf das Wetterbild in dieser URL mit rechts klicken und dann auf "Bild öffnen" (mit Opera). Dann habe ich die URL des gewünschten Bildes für mein Programm. Vielleicht gibt's auch eine direkte URL für das Segelflugwetter Stuttgart, wenn man sich auf der Seite vom DWD lange genug druchklickt? |
AW: Google Suchergebnisse abfragen
Zitat:
|
AW: Google Suchergebnisse abfragen
Stimmt es eigentlich das es gegen die AGBs von Google ist, ohne Google API auf die Suchresultate zuzugreifen. Ein Nachteil ist es ja auf jedenfall, weil die Werbung so leicht ausgeblendet wird.
Wegen dieser Antwort frage ich: Zitat:
![]() Die in dem verlinkten Beitrag vorgeschlagene Api gibt es scheinbar auch nicht mehr. Für Google gibt es nur noch eine kostenpflichtige. ![]() |
AW: Google Suchergebnisse abfragen
Ja, ist definitiv nicht erwünscht - aber trotzdem möglich. Google reagiert da u. U. automatisiert mit IP-Sperren auf deine Abfragen.
|
AW: Google Suchergebnisse abfragen
Zitat:
Gruß K-H |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz