Ich weiß nicht so recht mit welchen Befehlen ich das realisieren könnte...
Suchscripte (Youtube, Yahoo, Google, etc) abfragen
-
- [ offen ]
-
mipez -
23. Oktober 2010 um 17:44 -
Geschlossen -
Erledigt
-
-
Kannst du mir genauer erklären, was du haben möchtest?
Lg, Fabian
-
Ich auch nicht weil du nicht beschreibst was du willst
Wie soll das ablaufen?
-
Du könntest es vllt. mit der IE.au3 oder FF.au3 probieren.
-
Als Beispiel:
Ich will über Google/Youtube/Yahoo/... etwas suchen, also die direkten Suchfelder. Die Ergebnisse sollen dann in einer ListBox erscheinen (YT nur die Namen der Videos, Google etc. nur die Links). -
Schonmal versucht dne Quellcode nach einem Search auszulesen?!
Wobei das ziemlich viele Ergebnisse sind immer... So um die 4 Millionen allein bei "AutoIt"^^ -
[autoit]
_INetGetSource()
[/autoit]
StringRegExp() -
http://m.youtube.com/results?deskto…search_query%3Dhappy%2Bbirthday%26aq%3Df&aq=f&search_query=happy+birthday&gl=DE
<a accesskey="1" href="https://autoit.de/%27view-source:%5Burl']/watch?gl=DE&client=mv-google&hl=de&v=q4mJL-O5djg[/url]">Happy Birthday</a>
Das Suchprinzip von YT hab ich ja schon... nur will ich das ganze im Hintegrund ablaufen lassen... und da macht sich _IEBodyReadText schlecht :x
-
Fürs Auslesen des Quellcodes:
[autoit]
[/autoit]
$Source = BinaryToString(InetRead($URL))Btw kannste mich auch einfach im "anderen" Forum fragen PN und so
Und was macht deine Spoiler UDF? -
Fürs Auslesen des Quellcodes:
[autoit]
[/autoit]
$Source = BinaryToString(InetRead($URL))Btw kannste mich auch einfach im "anderen" Forum fragen PN und so
Und was macht deine Spoiler UDF?Achso... dachte InetRead gilt nur für Files oô
Und Spoiler liegt auf Eis, ich hab zwar rumprobiert, aber wirklich akzeptable Ergebnisse liefert nur GDI+ xD -
Achso... dachte InetRead gilt nur für Files oô
Und Spoiler liegt auf Eis, ich hab zwar rumprobiert, aber wirklich akzeptable Ergebnisse liefert nur GDI+ xDDas war FileRead was du meinst
Tjaja meine Spoiler UDF war halt von dem Thread aus die "Beste" -
Nee, ich meine zB. http://blubb.com/blubb.txt .
Ach ja StringRegExp("url halt","whatever",1) müsste doch in array[0] die Anzahl der Übereinstimmungen zurückgeben oder?Und pingu, jau ;D
-
Youtube und Google haben eine API, mit der du auf die Suche einfach zugreifen kannst.
http://code.google.com/intl/de/apis/y…ng_started.html
http://code.google.com/intl/de/apis/a…entation/#fonje
Bei Yahoo kenne ich jetzt keine. -
Ach du heilige... :x
So, wie verwende ich die C-Docs in AutoIt? xD
Suche müsste doch in der GDataQueryYouTube.h sein oder? -
Ich würde InetRead verwenden und dazu das hier lesen:
Edit: http://code.google.com/intl/de/apis/g…2.0/basics.html -
Wie siehts eig mit WinHttp aus?
[autoit]$open = _WinHttpOpen()
[/autoit]
$connect = _WinHttpConnect($open,"youtube.com")
$request = _WinHttpOpenRequest($connect, "POST")
$send = _WinHttpSendRequest($request, ?)Bis hierhin isses ja einfach, nur wie weiter? xD
-
Für die Suche wirst du wohl keine POST-Anfragen benötigen, daher sollte InetRead ausreichen. Ansonsten schaue dir mal die _WinHTTP_Simple... Funktionen an, die sind einfacher
Edit: Die Suche für YT ist hier genauer erkärt: http://code.google.com/intl/de/apis/y…hing_for_videos
-
...Öhm ja, ich glaub Quelltext is einfacher :x
-
Hatte gerade Lust etwas mit WinHttp zu machen
Habe hier ein rohes Script um die Treffer mit dem gewünschten Suchmuster zuerhalten.
Mit $ipage wird die Trefferseite ausgewähltSpoiler anzeigen
[autoit]#include <WinHTTP.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <Array.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $hHTTP_Host = "www.youtube.com"
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Global $hHTTP_Agent = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11")
Global $hHTTP_Connect = _WinHttpConnect($hHTTP_Agent, $hHTTP_Host)$sSearch = InputBox("YouTube Search","Suchbegriff")
[/autoit] [autoit][/autoit] [autoit]
If @error Then $sSearch = "Autoit"
$sSearch = StringReplace($sSearch," ","+")
$sPage = 1_Easy_WinHttp() ;Startseite ansteuern
[/autoit] [autoit][/autoit] [autoit]
Local $sRec = _Easy_WinHttp("GET","/results?search_query="&$sSearch&"&page="&$ipage)
$aRes = StringRegExp($sRec,'<a href=".+(v=.+?)" class="[^"]+" id="[^"]+" ><span class="img"><img(?: onload="tn_load\(\d+\);")? src="[^"]+"(?: thumb="[^"]+")? onclick="" title="(.+)"></span>',3)
$aSort = _ArraySplitTo2($aRes,"www.youtube.com\watch?")
_ArrayDisplay($aSort)
_WinHttpCloseHandle($hHTTP_Connect)Func _Easy_WinHttp($sType = "GET", $sPage = "/", $sPost = "")
[/autoit] [autoit][/autoit] [autoit]
$hHTTP_Request = _WinHttpOpenRequest($hHTTP_Connect, $sType, $sPage, "HTTP/1.1", $hHTTP_Host)
If StringLen($sPost) Then
_WinHttpSendRequest($hHTTP_Request, "Content-Type: application/x-www-form-urlencoded" & @CRLF, $sPost)
Else
_WinHttpSendRequest($hHTTP_Request)
EndIf
_WinHttpReceiveResponse($hHTTP_Request)
$sHtml = ""
Do
$sHtml &= _WinHttpReadData($hHTTP_Request)
Until @error
_WinHttpCloseHandle($hHTTP_Request)
Return $sHtml
EndFunc ;==>_Easy_WinHttpFunc _ArraySplitTo2($aArray,$sText1D ="",$sText2D ="")
[/autoit]
If Not IsArray($aArray) Then Return SetError(1,"",-1)
Local $iUbound = UBound($aArray) / 2
Local $iPos = 0
Local $aTmp[$iUbound][2]
For $Index = 0 To UBound($aArray)-1 Step 2
$aTmp[$iPos][0] = $sText1D & $aArray[$Index]
$aTmp[$iPos][1] = $sText2D & $aArray[$Index+1]
$iPos += 1
Next
Return $aTmp
EndFuncLg, Fabian
-
Öhm bei Zeile 18, StringRegExp, kannste mal das Zeug wie .+(v=.+?) und [^"]+ erklären?
Aber sonst läuft das doch auch über Quelltext, warum also nicht nur, wie oben bereits erwähnt, InetRead? -