orange Posted December 29, 2007 Share Posted December 29, 2007 (edited) Here is a neat script that I just worked up. Essentially, it uses Google's vast index to find specific files hosted anywhere on the internet. It is the same principle as websites like g2p.org. Sorry its not in UDF format - I know that. I don't usually do that for my scripts. This is the updated script -- with multiple downloads, new search options Code below is updated: expandcollapse popup;;Converted to work in 3.2.10.0 #include <GUIConstants.au3> #include <GuiComboBox.au3> #include <INET.au3> #include <array.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) #Region ### $MainGUI = GUICreate("Google File Downloader", 600, 552, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") $AvailableFilesListBox = _Guictrllistview_create($mainGUI, "File Name|Size|Type|Location", 8, 160, 297, 329) $FileInfomationGroup = GUICtrlCreateGroup("Search", 8, 8, 297, 145) $SearchText = GUICtrlCreateInput("", 16, 27, 281, 21) $FileNameShouldInclude = GUICtrlCreateInput("", 152, 58, 145, 21) $FileTypeCombo = GUICtrlCreateCombo("", 152, 93, 144, 25) GUICtrlSetOnEvent(-1, "FileTypeComboChange") GUICtrlSetData($FileTypeCombo,"Music|Movies|Programs|Images|CD/DVD Images|Torrents|Archives|Documents|Other") _GUICtrlComboBox_SelectString($FileTypeCombo, "Music") $FileTypeLabel = GUICtrlCreateLabel("File Type to Search For:", 16, 96, 117, 17) $ExtensionListEditBox = GUICtrlCreateInput("", 152, 123, 145, 21) $FileExtensionLabel = GUICtrlCreateLabel("Extension List:", 16, 126, 72, 17) $PhrasesToInclude = GUICtrlCreateLabel("Filename Might Contain:", 16, 61, 117, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchLimiterGroup = GUICtrlCreateGroup("Options", 312, 8, 281, 105) $MinimumFileFilterEnable = GUICtrlCreateCheckbox("Use Minimum File Size Filter:", 320, 32, 177, 17) $MinimumFileSizeEditBox = GUICtrlCreateInput("1", 497, 29, 49, 21) $MBLabel = GUICtrlCreateLabel("MB", 557, 32, 20, 17) $SearchTermLimiter = GUICtrlCreateCheckbox("Use File Name Filter", 320, 56, 113, 17) $SearchDepthLabel = GUICtrlCreateLabel("Maximum Google Results to Parse:", 320, 80, 168, 17) $MaxResultsInput = GUICtrlCreateInput("10", 496, 76, 81, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchButton = GUICtrlCreateButton("Search", 312, 120, 281, 33, 0) GUICtrlSetOnEvent(-1, "SearchButtonclick") $DownloadButton = GUICtrlCreateButton("Download All", 296, 504, 297, 33, 0) GUICtrlSetOnEvent(-1, "DownloadButtonclick") $ProgressBar = GUICtrlCreateProgress(8, 504, 281, 17) $ProgressInfoLabel = GUICtrlCreateLabel("0 Files in Download Queue", 8, 528, 285, 17) $FileQueue = _Guictrllistview_create($mainGUI,"File Name|Location", 352, 160, 241, 329) $AddToQueue = GUICtrlCreateButton(">", 312, 168, 33, 33, 0) GUICtrlSetOnEvent(-1, "AddToQueueClick") $RemoveFromQueue = GUICtrlCreateButton("<", 313, 213, 33, 33, 0) GUICtrlSetOnEvent(-1, "RemoveFromQueueClick") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### FileTypeComboChange() While 1 Sleep(100) WEnd func AddToQueueClick() $SelectionIndex = _GUICtrlListView_GetNextItem($AvailableFilesListBox) $SelectedText = _GUICtrlListView_GetItemTextString($AvailableFilesListBox,$SelectionIndex) $LineArray = StringSplit($SelectedText,"|") _GUICtrlListView_InsertItem($FileQueue,"",0) _GUICtrlListView_AddSubItem($FileQueue,0,$LineArray[1],0) _GUICtrlListView_AddSubItem($FileQueue,0,$LineArray[4],1) _GUICtrlListView_SetColumnWidth($FileQueue,0,$LVSCW_AUTOSIZE) EndFunc func RemoveFromQueueClick() _GUICtrlListView_DeleteItemsSelected ($FileQueue ) _GUICtrlListView_SetColumnWidth($FileQueue,0,$LVSCW_AUTOSIZE) EndFunc Func Progress($Percent, $Text) guictrlsetdata($ProgressBar, $Percent) guictrlsetdata($ProgressInfoLabel, $Text) EndFunc Func DownloadButtonclick() $Result = ping("www.google.com") if $Result = 0 then msgbox(32, "No Connection", "Please Connect to the Internet before downloading.") Return EndIf $NumberFiles = _GUICtrlListView_GetItemCount($FileQueue) $ItemText = _GUICtrlListView_GetItemTextArray($FileQueue) $SaveDirectory = FileSelectFolder("Select Download Folder","") for $i = 0 to $NumberFiles-1 $ItemText = _GUICtrlListView_GetItemText($FileQueue, $i,1) $FileName = _GUICtrlListView_GetItemText($FileQueue, $i,0) $Size = InetGetSize($ItemText) Inetget($ItemText,$SaveDirectory & $Filename,1,1) While @InetGetActive Progress(@InetGetBytesRead/$Size*100, Stringformat("%.2f", @InetGetBytesRead/1000) & " of " & _ int($size/1000) & " Kb") Sleep(250) Wend next Progress(0,"Done.") EndFunc Func MainGUIClose() Exit EndFunc Func FileTypeComboChange() $TypeToFind = Guictrlread($FileTypeCombo) Select case $TypeToFind = "Music" Guictrlsetdata($ExtensionListEditBox, "mp3 mp4 wma ogg flac aiff au gsm dct vox aac m4a atrac msv dvf m4p") case $TypeToFind = "Movies" Guictrlsetdata($ExtensionListEditBox, "3gp asf asx avi mov mpg mpeg mp4 ogm qt rm swf flv vob wmv") case $TypeToFind = "Programs" Guictrlsetdata($ExtensionListEditBox, "msi exe zip rar app") case $TypeToFind = "Images" Guictrlsetdata($ExtensionListEditBox, "jpg jpeg bmp tiff tif raw png gif ppm pgm pbm pnm svg") case $TypeToFind = "CD/DVD Images" Guictrlsetdata($ExtensionListEditBox, "iso bin cue vob nrg dmg mds ccd dvd") case $TypeToFind = "Torrents" Guictrlsetdata($ExtensionListEditBox, "torrent") case $TypeToFind = "Archives" Guictrlsetdata($ExtensionListEditBox, "zip rar 7z") case $TypeToFind = "Documents" Guictrlsetdata($ExtensionListEditBox, "doc pdf odt txt rtf") case Else GUICtrlSetData($ExtensionListEditBox, "") EndSelect EndFunc Func SearchButtonclick() $Query = Guictrlread($SearchText) $FileTypes = guictrlread($ExtensionListEditBox) $Delimiter = " " $MaxResults = guictrlread($MaxResultsInput) if guictrlread($SearchTermLimiter) = $GUI_CHECKED then $LimitSearch = True Else $LimitSearch = False EndIf if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $MinimumFileSize = guictrlread($MinimumFileSizeEditBox) Else $MinimumFileSize = 0 EndIf $ProgressOn = True _GUICtrlListView_DeleteAllItems($AvailableFilesListBox) $ResultArray = _GoogleFileFinder($Query, $FileTypes,$Delimiter, $MaxResults, $MinimumFileSize, $LimitSearch, $ProgressOn) $Count = 0 for $i = 0 to ubound($ResultArray)-1 Progress(($i+1)/(ubound($ResultArray)+1)*100, "Result " & $i & " of " & ubound ($ResultArray)) if Stringinstr($ResultArray[$i],"http")> 0 and Stringinstr($ResultArray[$i],"intitle:")=0 and stringlen($ResultArray[$i])>0 then $Filename = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],"/","",-1)) $Type = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],".","",-1)) $location = $ResultArray[$i] if stringlen($type) > 4 or $type = "" then $Type = "Unknown" if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $Size = StringFormat("%.2f", InetGetSize($ResultArray[$i])/1000000) & " MB" Else $Size = "N/A" EndIf if $Size = "N/A" or $Size > $MinimumFileSize then _GUICtrlListView_InsertItem($AvailableFilesListBox,"",0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0,stringreplace($FileName, "%20", " "),0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $size,1) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $type,2) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $location,3) $Count = $count + 1 EndIf EndIf Next _GUICtrlListView_SetColumnWidth($AvailableFilesListBox,0,$LVSCW_AUTOSIZE) Progress(0,$Count & " Files Found") EndFunc func _GoogleFileFinder($Query, $FileTypes,$Delimiter = " ", $MaxResults = 10, $MinimumFileSize = 0, $LimitSearch = False, $ProgressOn = False) ;Minimum File Size is in Megabytes local $SearchURL, $GoogleHTML, $LinkArray, $FileArray, $FullFileList, $QueryArray local $FullHTML, $FileTypeArray, $FileLinkExtractionPattern, $TempHTML $FileTypeArray = StringSplit($FileTypes, $Delimiter) $QueryArray = StringSplit(guictrlread($FileNameShouldInclude), $Delimiter) $FileTypes = stringreplace($FileTypes, $Delimiter,"%7C") $Query = stringreplace($Query, $Delimiter,".") $SearchURL = "http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28" & _ $FileTypes&"%29+"& $Query &"+-html+-htm+-php+-js+-asp+-jsp&btnG=Google+Search&num=" & $MaxResults $GoogleHTML = _InetGetSource($SearchURL) $LinkExtractPattern = '(?i)href="(.*?)"' $LinkArray = StringRegExp($GoogleHTML, $LinkExtractPattern,3) Progress("","Finding Host Websites...") for $CurrentURL = 0 to ubound($LinkArray)-1 Progress(($CurrentURL + 1)/(ubound($LinkArray)-1) *100, "Limiting Searched Links: " & $CurrentURL+1 & " of " & ubound($LinkArray)) $GoogleIncluded = StringInStr($LinkArray[$CurrentURL],"google") $CacheIncluded = StringInStr($LinkArray[$CurrentURL],"cache") $GSearchIncluded = StringInStr($LinkArray[$CurrentURL],"/search?") if $GoogleIncluded = 0 and $CacheIncluded = 0 and $GSearchIncluded = 0 Then $TempHTML = _INetGetSource($LinkArray[$CurrentURL]) $TempHTML = StringReplace($TempHTML,'href="', 'href="' & $LinkArray[$CurrentURL]) $FullHTML = $FullHTML & $TempHTML EndIf Next For $CurrentType = 1 to ubound($FileTypeArray)-1 Progress(($CurrentType + 1)/(ubound($FileTypeArray)-1) *100, "Finding File Links: " & _ $CurrentType + 1 & " of " & ubound($FileTypeArray)-1) $FileLinkExtractionPattern = '(?i)href="(.*?)'&$FileTypeArray[$CurrentType]&'"' $FileArray = StringRegExp($FullHTML, $FileLinkExtractionPattern,3) for $TypeNum = 0 to ubound($FileArray) -1 $FileArray[$TypeNum] = $FileArray[$TypeNum] & $FileTypeArray[$CurrentType] Next $FullFileList = $FullFileList & _ArrayToString($FileArray,"|") & "|" Next $FileArray = "" $FileArray = StringSplit($FullFileList,"|") if $LimitSearch Then $LimitedFileList = "" For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 ) *100, "Limiting Search Results: " & $CurrentFile +1 & " of " & ubound ($FileArray)) $IncludeThis = False $HasHTTP = False if Stringinstr($FileArray[$CurrentFile], "http:")>0 then $HasHTTP = True for $CurrentQuery = 1 to ubound($QueryArray) -1 if Stringinstr($FileArray[$CurrentFile], $QueryArray[$CurrentQuery]) > 0 then $IncludeThis = True ExitLoop EndIf Next if $HasHTTP and $IncludeThis Then $LimitedFileList = $LimitedFileList & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($LimitedFileList,"|") EndIf ProgressOff() return $FileArray EndFunc Edited January 5, 2008 by orange Link to comment Share on other sites More sharing options...
gseller Posted December 29, 2007 Share Posted December 29, 2007 Very nice!! Thank you! Link to comment Share on other sites More sharing options...
thomaatje Posted December 29, 2007 Share Posted December 29, 2007 This realy is what i needed... i hate typing the long syntax in google just for 1 file Thx Link to comment Share on other sites More sharing options...
James Posted December 29, 2007 Share Posted December 29, 2007 This is brilliant, it's nice to see yopu back Orange! I use this method for finding MP3. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
zxzxzx Posted December 29, 2007 Share Posted December 29, 2007 Here is a neat script that I just worked up. Essentially, it uses Google's vast index to find specific files hosted anywhere on the internet. It is the same principle as websites like g2p.org. Sorry its not in UDF format - I know that. I don't usually do that for my scripts. The return value of this function is an array of direct links to files. To download the files, use InetGet(). Ok, formatting: _GoogleFileFinder($Query, $FileTypes,$Delimiter = " ", $MaxResults = 10, $MinimumFileSize = 0, $LimitSearch = False, $ProgressOn = False)oÝ÷ ÛMúBç«ÊØ^²Úâajܨ»§¶Ú,yªÜú+¶W§jg´ß¡bäò¥ëzX¦×¢»" ^~)^·*^²Ú,yªÜú+¶¬yªÞ{^ȨÊr«±í7è7¥hz»ay×¥hz»¬y×讫¯&§uø¥zÜ©zÍ7èƱEë.Û-騲Ø(¢ ^¥¨²Ú,yªÜØk¢è!¶¡^®Ø^éz»azZ'êâ¶Ö¤zÆî¶Ø^uç©z¸±æ«r¬Ó~x¦ºabä¢ÍèÊ°j{m¢åÉø§v·©Ýv'i¹^~)^²Ç¶¬(!z»aj}"ÊÞéí²)æzÊ׬Ó~hIæ«rb+mçâ©kzË¥¶ÆÚ±çhØ^ªç«Ê)éºÝ7èúè·¬°éĦåzÆ©®+zËj»h²0¦º ë,-¢ë¶¬¶âÙ®²'¢}ý¶ø¨«^rr®(!·Øb²Úò¶¬jëh×6_GoogleFileFinder("bob marley", "mp3 mp4 wma ogg wma")oÝ÷ ÚÚw^Åç.µ¦åzÇhm¾*%j×¢«mÂ+a¶¬¶¼+ºÚ"µÍÑÛÛÙÛQ[Q[ ][ÝÜYÚ[][ÝË ][ÝÙ^H ][ÝÊoÝ÷ Ø ev¥ay-«m+"²Þ¶Ü¢HµÊ.ÖÞºÇ~ÚÂ)Ý£jǪê-ôÆ:®¢Úk¢ ÚÚ æÚ±çiÚëÊ+hºØ¦¦º/zØ^r^êÞÊ ¡«¢+Ø¥¹±Õ±Ðí%9P¹ÔÌÐì(¥¹±Õ±ÐíÉÉä¹ÔÌÐì((ÀÌØíQµÁÉÉäô}½½±¥±¥¹È ÅÕ½ÐíÁ¥¥¸ÅÕ½Ðì°ÅÕ½Ðíáé¥ÀÉÈÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÄÀÀ°À±±Í°QÉÕ¤()}ÉÉå¥ÍÁ±ä ÀÌØíQµÁÉÉä¤()Õ¹}½½±¥±¥¹È ÀÌØíEÕÉä°ÀÌØí¥±QåÁÌ°ÀÌØí±¥µ¥ÑÈôÅÕ½ÐìÅÕ½Ðì°ÀÌØí5áIÍÕ±ÑÌôÄÀ°ÀÌØí5¥¹¥µÕµ¥±M¥éôÀ°ÀÌØí1¥µ¥ÑMÉ ô±Í°ÀÌØíAɽÉÍÍ=¸ô±Í¤(($í5¥¹¥µÕ´¥±M¥é¥Ì¥¸5åÑÌ($(%AɽÉÍÍ=¸ ÅÕ½Ðí½½±¥±¥¹ÈÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤($(%±½°ÀÌØíMÉ¡UI0°ÀÌØí½½±!Q50°ÀÌØí1¥¹ÉÉä°ÀÌØí¥±ÉÉä°ÀÌØíÕ±±¥±1¥ÍаÀÌØíEÕÉåÉÉä(%±½°ÀÌØíÕ±±!Q50°ÀÌØí¥±QåÁÉÉä°ÀÌØí¥±1¥¹áÑÉÑ¥½¹AÑÑɸ°ÀÌØíQµÁ!Q50($($ÀÌØí¥±QåÁÉÉäôMÑÉ¥¹MÁ±¥Ð ÀÌØí¥±QåÁÌ°ÀÌØí±¥µ¥ÑȤ($ÀÌØíEÕÉåÉÉäôMÑÉ¥¹MÁ±¥Ð ÀÌØíEÕÉä°ÀÌØí±¥µ¥ÑȤ($ÀÌØí¥±QåÁÌôÍÑÉ¥¹ÉÁ± ÀÌØí¥±QåÁÌ°ÀÌØí±¥µ¥ÑÈ°ÅÕ½ÐìÝÅÕ½Ðì¤($ÀÌØíEÕÉäôÍÑÉ¥¹ÉÁ± ÀÌØíEÕÉä°ÀÌØí±¥µ¥ÑÈ°ÅÕ½Ðì¸ÅÕ½Ðì¤($$($ÀÌØíMÉ¡UI0ôÅÕ½Ðí¡ÑÑÀè¼½ÝÝܹ½½±¹½´½ÍÉ ý¡°õ¸µÀíÄõ¥¹Ñ¥Ñ±ÍÈÉ¥¹à¹½ÈȬÈàÅÕ½ÐìµÀì|($$ÀÌØí¥±QåÁ̵ÀìÅÕ½ÐìÈä¬ÅÕ½ÐìµÀìÀÌØíEÕÉäµÀìÅÕ½Ð쬵¡Ñµ°¬µ¡Ñ´¬µÁ¡À¬µ©Ì¬µÍÀ¬µ©ÍÀµÀíѹõ½½±MÉ µÀí¹Õ´ôÅÕ½ÐìµÀìÀÌØí5áIÍÕ±ÑÌ($$($ÀÌØí½½±!Q50ô}%¹ÑÑM½ÕÉ ÀÌØíMÉ¡UI0¤($ÀÌØí1¥¹áÑÉÑAÑÑɸôÌäì ý¤¥¡ÉôÅÕ½Ðì ¸¨ü¤ÅÕ½ÐìÌäì($ÀÌØí1¥¹ÉÉäôMÑÉ¥¹IáÀ ÀÌØí½½±!Q50°ÀÌØí1¥¹áÑÉÑAÑÑɸ°Ì¤(%AɽÉÍÍÍÐ ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí¥¹¥¹!½ÍÐ]Í¥Ñ̸¸¸ÅÕ½Ðì¤(%½ÈÀÌØí ÕÉɹÑUI0ôÀѼսչ ÀÌØí1¥¹ÉÉ䤴Ä($%AɽÉÍÍMÐ ÀÌØí ÕÉɹÑUI0¬Ä¤¼¡Õ½Õ¹ ÀÌØí1¥¹ÉÉ䤴Ĥ¨ÄÀÀ°ÅÕ½Ðí1¥µ¥Ñ¥¹MÉ¡1¥¹ÌèÅÕ½ÐìµÀìÀÌØí ÕÉɹÑUI0¬ÄµÀìÅÕ½Ðì½ÅÕ½ÐìµÀìÕ½Õ¹ ÀÌØí1¥¹ÉÉ䤤($$ÀÌØí½½±%¹±ÕôMÑÉ¥¹%¹MÑÈ ÀÌØí1¥¹ÉÉålÀÌØí ÕÉɹÑUI1t°ÅÕ½Ðí½½±ÅÕ½Ðì¤($$ÀÌØí ¡%¹±ÕôMÑÉ¥¹%¹MÑÈ ÀÌØí1¥¹ÉÉålÀÌØí ÕÉɹÑUI1t°ÅÕ½Ðí¡ÅÕ½Ðì¤($$ÀÌØíMÉ¡%¹±ÕôMÑÉ¥¹%¹MÑÈ ÀÌØí1¥¹ÉÉålÀÌØí ÕÉɹÑUI1t°ÅÕ½Ðì½ÍÉ üÅÕ½Ðì¤$($%¥ÀÌØí½½±%¹±ÕôÀ¹ÀÌØí ¡%¹±ÕôÀ¹ÀÌØíMÉ¡%¹±ÕôÀQ¡¸$($$$ÀÌØíQµÁ!Q50ô}%9ÑÑM½ÕÉ ÀÌØí1¥¹ÉÉålÀÌØí ÕÉɹÑUI1t¤($$$ÀÌØíQµÁ!Q50ôMÑÉ¥¹IÁ± ÀÌØíQµÁ!Q50°Ìäí¡ÉôÅÕ½ÐìÌäì°Ìäí¡ÉôÅÕ½ÐìÌäìµÀìÀÌØí1¥¹ÉÉålÀÌØí ÕÉɹÑUI1t¤($$$ÀÌØíÕ±±!Q50ôÀÌØíÕ±±!Q50µÀìÀÌØíQµÁ!Q50$($%¹%$$(%9áÐ($(%½ÈÀÌØí ÕÉɹÑQåÁôÄѼսչ ÀÌØí¥±QåÁÉÉ䤴Ä($%AɽÉÍÍMÐ ÀÌØí ÕÉɹÑQåÁ¬Ä¤¼¡Õ½Õ¹ ÀÌØí¥±QåÁÉÉ䤴Ĥ¨ÄÀÀ°ÅÕ½Ðí¥¹¥¹¥±1¥¹ÌèÅÕ½ÐìµÀì|($$$ÀÌØí ÕÉɹÑQåÁ¬ÄµÀìÅÕ½Ðì½ÅÕ½ÐìµÀìÕ½Õ¹ ÀÌØí¥±QåÁÉÉ䤴Ĥ($$$($$ÀÌØí¥±1¥¹áÑÉÑ¥½¹AÑÑɸôÌäì ý¤¥¡ÉôÅÕ½Ðì ¸¨ü¤ÌäìµÀìÀÌØí¥±QåÁÉÉålÀÌØí ÕÉɹÑQåÁtµÀìÌäìÅÕ½ÐìÌäì($$ÀÌØí¥±ÉÉäôMÑÉ¥¹IáÀ ÀÌØíÕ±±!Q50°ÀÌØí¥±1¥¹áÑÉÑ¥½¹AÑÑɸ°Ì¤($%½ÈÀÌØíQåÁ9Õ´ôÀѼսչ ÀÌØí¥±ÉÉ䤴Ä($$$ÀÌØí¥±ÉÉålÀÌØíQåÁ9ÕµtôÀÌØí¥±ÉÉålÀÌØíQåÁ9ÕµtµÀìÀÌØí¥±QåÁÉÉålÀÌØí ÕÉɹÑQåÁt($%9áÐ($$ÀÌØíÕ±±¥±1¥ÍÐôÀÌØíÕ±±¥±1¥ÍеÀì}ÉÉåQ½MÑÉ¥¹ ÀÌØí¥±ÉÉä°ÅÕ½ÐíðÅÕ½Ð줵ÀìÅÕ½ÐíðÅÕ½Ðì(%9áÐ($ÀÌØí¥±ÉÉäôÅÕ½ÐìÅÕ½Ðì($ÀÌØí¥±ÉÉäôMÑÉ¥¹MÁ±¥Ð ÀÌØíÕ±±¥±1¥ÍаÅÕ½ÐíðÅÕ½Ðì¤$($(%¥ÀÌØí1¥µ¥ÑMÉ Q¡¸($$ÀÌØí1¥µ¥Ñ¥±1¥ÍÐôÅÕ½ÐìÅÕ½Ðì($%½ÈÀÌØí ÕÉɹѥ±ôÀѼսչ ÀÌØí¥±ÉÉ䤴Ä($$%AɽÉÍÍMÐ ÀÌØí ÕÉɹѥ±¬Ä¤¼¡Õ½Õ¹ ÀÌØí¥±ÉÉ䤴Ĥ¨ÄÀÀ°ÅÕ½Ðí1¥µ¥Ñ¥¹MÉ IÍÕ±ÑÌèÅÕ½ÐìµÀìÀÌØí ÕÉɹѥ±¬ÄµÀìÅÕ½Ðì½ÅÕ½ÐìµÀìÕ½Õ¹ ÀÌØí¥±ÉÉ䤤($$$ÀÌØí%¹±ÕQ¡¥Ìô±Í($$$ÀÌØí!Í!QQ@ô±Í($$%¥MÑÉ¥¹¥¹ÍÑÈ ÀÌØí¥±ÉÉålÀÌØí ÕÉɹѥ±t°ÅÕ½Ðí¡ÑÑÀèÅÕ½Ðì¤ÐìÀÑ¡¸ÀÌØí!Í!QQ@ôQÉÕ($$$$($$%½ÈÀÌØí ÕÉɹÑEÕÉäôÄѼսչ ÀÌØíEÕÉåÉÉ䤴Ä($$$%¥MÑÉ¥¹¥¹ÍÑÈ ÀÌØí¥±ÉÉålÀÌØí ÕÉɹѥ±t°ÀÌØíEÕÉåÉÉålÀÌØí ÕÉɹÑEÕÉåt¤ÐìÀÑ¡¸($$$$$ÀÌØí%¹±ÕQ¡¥ÌôQÉÕ($$$$%á¥Ñ1½½À($$$%¹%($$%9áÐ($$%¥ÀÌØí!Í!QQ@¹ÀÌØí%¹±ÕQ¡¥ÌQ¡¸($$$$ÀÌØí1¥µ¥Ñ¥±1¥ÍÐôÀÌØí1¥µ¥Ñ¥±1¥ÍеÀìÀÌØí¥±ÉÉålÀÌØí ÕÉɹѥ±tµÀìÅÕ½ÐíðÅÕ½Ðì($$$$($$%¹%($%9áÐ($$ÀÌØí¥±ÉÉäôÅÕ½ÐìÅÕ½Ðì($$ÀÌØí¥±ÉÉäôMÑÉ¥¹MÁ±¥Ð ÀÌØí1¥µ¥Ñ¥±1¥ÍаÅÕ½ÐíðÅÕ½Ðì¤(%¹%($(%¥ÀÌØí5¥¹¥µÕµ¥±M¥éÐìÀÑ¡¸($$ÀÌØí¥±M¥é1¥µ¥ÑôÌäìÌäì($%½ÈÀÌØí ÕÉɹѥ±ôÀѼսչ ÀÌØí¥±ÉÉ䤴Ä($$%AɽÉÍÍMÐ ÀÌØí ÕÉɹѥ±¬Ä¤¼¡Õ½Õ¹ ÀÌØí¥±ÉÉ䤴Ĥ¨ÄÀÀ°ÅÕ½Ðí ¡¥¹¥±M¥éèÅÕ½ÐìµÀìÀÌØí ÕÉɹѥ±¬ÄµÀìÅÕ½Ðì½ÅÕ½ÐìµÀìÕ½Õ¹ ÀÌØí¥±ÉÉ䤤($$%¥ÀÌØí5¥¹¥µÕµ¥±M¥éÐì%¹ÑÑM¥é ÀÌØí¥±ÉÉålÀÌØí ÕÉɹѥ±t¤¼ÄÀÀÀÀÀÀQ¡¸($$$$ÀÌØí¥±M¥é1¥µ¥ÑôÀÌØí¥±M¥é1¥µ¥ÑµÀìÀÌØí¥±ÉÉålÀÌØí ÕÉɹѥ±tµÀìÅÕ½ÐíðÅÕ½Ðì($$%¹%($%9áÐ($$ÀÌØí¥±ÉÉäôÅÕ½ÐìÅÕ½Ðì($$ÀÌØí¥±ÉÉäôMÑÉ¥¹MÁ±¥Ð ÀÌØí¥±M¥é1¥µ¥Ñ°ÅÕ½ÐíðÅÕ½Ðì¤(%¹%(%AɽÉÍÍ= ¤(%ÉÑÕɸÀÌØí¥±ÉÉä)¹Õ¹Thank Link to comment Share on other sites More sharing options...
James Posted December 29, 2007 Share Posted December 29, 2007 Oh what the hell? Why does the forum have to mess up the code? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
orange Posted December 29, 2007 Author Share Posted December 29, 2007 Thanks for all the positive comments! Any suggestions for its improvement? Link to comment Share on other sites More sharing options...
gseller Posted December 29, 2007 Share Posted December 29, 2007 I can only suggest going the next step of adding a GUI with an input and maybe a combo with a file extension to search for then take the returned array and create a working link for each returned link... Haha basically do the work everyone is thinking about so we can all be lazy and download your great work.. LOL ~You asked~ Link to comment Share on other sites More sharing options...
NELyon Posted December 29, 2007 Share Posted December 29, 2007 This is like an Autoit-based interface for jimmyr.com/mp3.php Kewl! Link to comment Share on other sites More sharing options...
orange Posted December 29, 2007 Author Share Posted December 29, 2007 Note the updated GUI... Link to comment Share on other sites More sharing options...
gseller Posted December 30, 2007 Share Posted December 30, 2007 Yep, That is sweet!! Here is the converted version for 3.2.10.0 expandcollapse popup;Converted to work in 3.2.10.0 #include <GUIConstants.au3> #include <GuiComboBox.au3> #include <INET.au3> #include <array.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) #Region ### $MainGUI = GUICreate("Google File Downloader", 600, 552, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") $AvailableFilesListBox = GUICtrlCreateListView("File Name|Size|Type|Location", 8, 168, 585, 329) $FileInfomationGroup = GUICtrlCreateGroup("Search", 8, 8, 297, 105) $SearchText = GUICtrlCreateInput("", 16, 27, 281, 21) $FileTypeCombo = GUICtrlCreateCombo("", 152, 53, 144, 25) GUICtrlSetOnEvent(-1, "FileTypeComboChange") GUICtrlSetData($FileTypeCombo,"Music|Movies|Programs|Images|CD/DVD Images|Torrents|Archives|Documents|Other") _GUICtrlComboBox_SelectString($FileTypeCombo, 0, "Music") $FileTypeLabel = GUICtrlCreateLabel("File Type to Search For:", 16, 56, 117, 17) $ExtensionListEditBox = GUICtrlCreateInput("", 152, 83, 145, 21) $FileExtensionLabel = GUICtrlCreateLabel("Extension List:", 16, 86, 72, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchLimiterGroup = GUICtrlCreateGroup("Options", 312, 8, 281, 105) $MinimumFileFilterEnable = GUICtrlCreateCheckbox("Only Return Files Greater Than:", 320, 32, 177, 17) $MinimumFileSizeEditBox = GUICtrlCreateInput("0", 504, 29, 49, 21) $MBLabel = GUICtrlCreateLabel("MB", 565, 32, 20, 17) $EnableProgressBar = GUICtrlCreateCheckbox("Show Progress Bar", 320, 56, 177, 17) GUICtrlSetState(-1,$Gui_CHECKED) $SearchDepthLabel = GUICtrlCreateLabel("Maximum Google Results to Parse:", 320, 80, 168, 17) $MaxResultsInput = GUICtrlCreateInput("10", 496, 76, 81, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchButton = GUICtrlCreateButton("Search", 8, 120, 297, 33, 0) GUICtrlSetOnEvent(-1, "SearchButtonclick") $DownloadButton = GUICtrlCreateButton("Download", 296, 504, 297, 40, 0) GUICtrlSetOnEvent(-1, "DownloadButtonclick") $ProgressBar = GUICtrlCreateProgress(8, 504, 281, 17) $ProgressInfoLabel = GUICtrlCreateLabel("Progress Info", 8, 528, 200, 17) $SearchTermLimiter = GUICtrlCreateCheckbox("Include Search Terms in Filename", 320, 132, 277, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### FileTypeComboChange() While 1 Sleep(100) WEnd Func Progress($Percent, $Text) guictrlsetdata($ProgressBar, $Percent) guictrlsetdata($ProgressInfoLabel, $Text) EndFunc Func DownloadButtonclick() $SelectionIndex = _GUICtrlListView_GetNextItem($AvailableFilesListBox) $SelectedText = _GUICtrlListView_GetItemTextString($AvailableFilesListBox,$SelectionIndex) $LineArray = StringSplit($SelectedText,"|") $SaveFile = FileSaveDialog("Download File To...",@DesktopCommonDir,"","",$LineArray[1]) $Size = InetGetSize($LineArray[4]) Inetget($LineArray[4],$SaveFile,1,1) While @InetGetActive Progress(@InetGetBytesRead/$Size*100, Stringformat("%.2f", @InetGetBytesRead/1000) & " Kb") Sleep(250) Wend Progress(0,"Complete") EndFunc Func MainGUIClose() Exit EndFunc Func FileTypeComboChange() $TypeToFind = Guictrlread($FileTypeCombo) Select case $TypeToFind = "Music" Guictrlsetdata($ExtensionListEditBox, "mp3 mp4 wma ogg flac aiff raw au gsm dct vox aac m4a atrac ra ram msv dvf m4p") case $TypeToFind = "Movies" Guictrlsetdata($ExtensionListEditBox, "3gp asf asx avi mov mpg mpeg mp4 ogm qt rm swf flv vob wmv") case $TypeToFind = "Programs" Guictrlsetdata($ExtensionListEditBox, "msi exe zip rar app") case $TypeToFind = "Images" Guictrlsetdata($ExtensionListEditBox, "jpg jpeg bmp tiff tif raw png gif ppm pgm pbm pnm svg") case $TypeToFind = "CD/DVD Images" Guictrlsetdata($ExtensionListEditBox, "iso bin cue vob nrg dmg mds ccd dvd") case $TypeToFind = "Torrents" Guictrlsetdata($ExtensionListEditBox, "torrent") case $TypeToFind = "Archives" Guictrlsetdata($ExtensionListEditBox, "zip rar 7z") case $TypeToFind = "Documents" Guictrlsetdata($ExtensionListEditBox, "doc pdf odt txt rtf") case Else GUICtrlSetData($ExtensionListEditBox, "") EndSelect EndFunc Func SearchButtonclick() $Query = Guictrlread($SearchText) $FileTypes = guictrlread($ExtensionListEditBox) $Delimiter = " " $MaxResults = guictrlread($MaxResultsInput) if guictrlread($SearchTermLimiter) = $GUI_CHECKED then $LimitSearch = True Else $LimitSearch = False EndIf if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $MinimumFileSize = guictrlread($MinimumFileSizeEditBox) Else $MinimumFileSize = 0 EndIf if guictrlread($EnableProgressBar) = $GUI_CHECKED then $ProgressOn = true Else $ProgressOn = False EndIf $ResultArray = _GoogleFileFinder($Query, $FileTypes,$Delimiter, $MaxResults, $MinimumFileSize, $LimitSearch, $ProgressOn) for $i = 0 to ubound($ResultArray)-1 Progress(($i+1)/(ubound($ResultArray)+1)*100, "Result " & $i & " of " & ubound ($ResultArray)) if Stringinstr($ResultArray[$i],"http")> 0 and Stringinstr($ResultArray[$i],"intitle:")=0 and stringlen($ResultArray[$i])>0 then $Filename = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],"/","",-1)) $Type = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],".","",-1)) $location = $ResultArray[$i] if stringlen($type) > 4 or $type = "" then $Type = "Unknown" if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $Size = StringFormat("%.2f", InetGetSize($ResultArray[$i])/1000000) & " MB" Else $Size = "N/A" EndIf _GUICtrlListView_InsertItem($AvailableFilesListBox,0, stringreplace($FileName, "%20", " ") & "|" & $Size & "|" & $Type & "|" & $Location) EndIf Next _GUICtrlListView_SetColumnWidth($AvailableFilesListBox,0,$LVSCW_AUTOSIZE) Progress(0,"") EndFunc func _GoogleFileFinder($Query, $FileTypes,$Delimiter = " ", $MaxResults = 10, $MinimumFileSize = 0, $LimitSearch = False, $ProgressOn = False) ;Minimum File Size is in Megabytes local $SearchURL, $GoogleHTML, $LinkArray, $FileArray, $FullFileList, $QueryArray local $FullHTML, $FileTypeArray, $FileLinkExtractionPattern, $TempHTML $FileTypeArray = StringSplit($FileTypes, $Delimiter) $QueryArray = StringSplit($Query, $Delimiter) $FileTypes = stringreplace($FileTypes, $Delimiter,"%7C") $Query = stringreplace($Query, $Delimiter,".") $SearchURL = "[url="http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28"]http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28[/url]"& _ $FileTypes&"%29+"& $Query &"+-html+-htm+-php+-js+-asp+-jsp&btnG=Google+Search&num=" & $MaxResults $GoogleHTML = _InetGetSource($SearchURL) $LinkExtractPattern = '(?i)href="(.*?)"' $LinkArray = StringRegExp($GoogleHTML, $LinkExtractPattern,3) Progress("","Finding Host Websites...") for $CurrentURL = 0 to ubound($LinkArray)-1 Progress(($CurrentURL + 1)/(ubound($LinkArray)-1) *100, "Limiting Searched Links: " & $CurrentURL+1 & " of " & ubound($LinkArray)) $GoogleIncluded = StringInStr($LinkArray[$CurrentURL],"google") $CacheIncluded = StringInStr($LinkArray[$CurrentURL],"cache") $GSearchIncluded = StringInStr($LinkArray[$CurrentURL],"/search?") if $GoogleIncluded = 0 and $CacheIncluded = 0 and $GSearchIncluded = 0 Then $TempHTML = _INetGetSource($LinkArray[$CurrentURL]) $TempHTML = StringReplace($TempHTML,'href="', 'href="' & $LinkArray[$CurrentURL]) $FullHTML = $FullHTML & $TempHTML EndIf Next For $CurrentType = 1 to ubound($FileTypeArray)-1 Progress(($CurrentType + 1)/(ubound($FileTypeArray)-1) *100, "Finding File Links: " & _ $CurrentType + 1 & " of " & ubound($FileTypeArray)-1) $FileLinkExtractionPattern = '(?i)href="(.*?)'&$FileTypeArray[$CurrentType]&'"' $FileArray = StringRegExp($FullHTML, $FileLinkExtractionPattern,3) for $TypeNum = 0 to ubound($FileArray) -1 $FileArray[$TypeNum] = $FileArray[$TypeNum] & $FileTypeArray[$CurrentType] Next $FullFileList = $FullFileList & _ArrayToString($FileArray,"|") & "|" Next $FileArray = "" $FileArray = StringSplit($FullFileList,"|") if $LimitSearch Then $LimitedFileList = "" For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 ) *100, "Limiting Search Results: " & $CurrentFile +1 & " of " & ubound ($FileArray)) $IncludeThis = False $HasHTTP = False if Stringinstr($FileArray[$CurrentFile], "http:")>0 then $HasHTTP = True for $CurrentQuery = 1 to ubound($QueryArray) -1 if Stringinstr($FileArray[$CurrentFile], $QueryArray[$CurrentQuery]) > 0 then $IncludeThis = True ExitLoop EndIf Next if $HasHTTP and $IncludeThis Then $LimitedFileList = $LimitedFileList & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($LimitedFileList,"|") EndIf if $MinimumFileSize > 0 then $FileSizeLimited = '' For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 )*100, "Checking File Size: " & $CurrentFile +1 & " of " & ubound($FileArray)) if $MinimumFileSize > InetGetSize($FileArray[$CurrentFile])/1000000 Then $FileSizeLimited = $FileSizeLimited & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($FileSizeLimited,"|") EndIf ProgressOff() return $FileArray EndFunc Enjoy! Link to comment Share on other sites More sharing options...
Who Posted December 30, 2007 Share Posted December 30, 2007 search.au3 (154) : ==> Unterminated string.: $SearchURL = "http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28" target="_blank">http://www.google.com/search?hl=en&q=i...index.of%22+%28"& _ Link to comment Share on other sites More sharing options...
orange Posted December 30, 2007 Author Share Posted December 30, 2007 change it to this, and it should work. $SearchURL = "http://www.google.com/search?hl=en&q=i...index.of%22+%28" & _ Sorry for using old autoit guys... I forget to upgrade sometimes. Link to comment Share on other sites More sharing options...
Who Posted December 30, 2007 Share Posted December 30, 2007 I changed it into : $SearchURL = "http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28" & _ $FileTypes&"%29+"& $Query &"+-html+-htm+-php+-js+-asp+-jsp&btnG=Google+Search&num=" & $MaxResults But the script doesn't work at all, after searching, it returns nothing. I'm using AutoIT 3.2.10.0b Link to comment Share on other sites More sharing options...
gseller Posted December 30, 2007 Share Posted December 30, 2007 Well, I made the changes and it doesn't seem to work for me... Link to comment Share on other sites More sharing options...
orange Posted December 30, 2007 Author Share Posted December 30, 2007 I changed it into : $SearchURL = "http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28" & _ $FileTypes&"%29+"& $Query &"+-html+-htm+-php+-js+-asp+-jsp&btnG=Google+Search&num=" & $MaxResults But the script doesn't work at all, after searching, it returns nothing. I'm using AutoIT 3.2.10.0b what are you searching for? not everything will be found by this. and I haven't added the "no files found" dialog yet. Link to comment Share on other sites More sharing options...
orange Posted December 30, 2007 Author Share Posted December 30, 2007 Well, I made the changes and it doesn't seem to work for me...are you using my code, or your adjusted code?(I need to know which one to debug for you) Link to comment Share on other sites More sharing options...
Who Posted December 30, 2007 Share Posted December 30, 2007 No, after making the change, I got this :And I think this feature should be added :http://computers2007.wordpress.com/2007/10/06/exclude-term-from-google-search/ Link to comment Share on other sites More sharing options...
orange Posted December 30, 2007 Author Share Posted December 30, 2007 No, after making the change, I got this : And I think this feature should be added : http://computers2007.wordpress.com/2007/10/06/exclude-term-from-google-search/ Well, since I wrote this in an old version of AutoIt, it needs to be converted to the new. GESELLER did a good job, but there are still a few things that need to be done. The function itself still works, but the display of the values is not quite right. I will have it finished in a few moments. Link to comment Share on other sites More sharing options...
orange Posted December 30, 2007 Author Share Posted December 30, 2007 Tested on Vista -- works. expandcollapse popup;Converted to work in 3.2.10.0 #include <GUIConstants.au3> #include <GuiComboBox.au3> #include <INET.au3> #include <array.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) #Region ### $MainGUI = GUICreate("Google File Downloader", 600, 552, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") $AvailableFilesListBox = GUICtrlCreateListView("File Name|Size|Type|Location", 8, 168, 585, 329) $FileInfomationGroup = GUICtrlCreateGroup("Search", 8, 8, 297, 105) $SearchText = GUICtrlCreateInput("", 16, 27, 281, 21) $FileTypeCombo = GUICtrlCreateCombo("", 152, 53, 144, 25) GUICtrlSetOnEvent(-1, "FileTypeComboChange") GUICtrlSetData($FileTypeCombo,"Music|Movies|Programs|Images|CD/DVD Images|Torrents|Archives|Documents|Other") _GUICtrlComboBox_SelectString($FileTypeCombo, "Music") $FileTypeLabel = GUICtrlCreateLabel("File Type to Search For:", 16, 56, 117, 17) $ExtensionListEditBox = GUICtrlCreateInput("", 152, 83, 145, 21) $FileExtensionLabel = GUICtrlCreateLabel("Extension List:", 16, 86, 72, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchLimiterGroup = GUICtrlCreateGroup("Options", 312, 8, 281, 105) $MinimumFileFilterEnable = GUICtrlCreateCheckbox("Only Return Files Greater Than:", 320, 32, 177, 17) $MinimumFileSizeEditBox = GUICtrlCreateInput("0", 504, 29, 49, 21) $MBLabel = GUICtrlCreateLabel("MB", 565, 32, 20, 17) $EnableProgressBar = GUICtrlCreateCheckbox("Show Progress Bar", 320, 56, 177, 17) GUICtrlSetState(-1,$Gui_CHECKED) $SearchDepthLabel = GUICtrlCreateLabel("Maximum Google Results to Parse:", 320, 80, 168, 17) $MaxResultsInput = GUICtrlCreateInput("10", 496, 76, 81, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $SearchButton = GUICtrlCreateButton("Search", 8, 120, 297, 33, 0) GUICtrlSetOnEvent(-1, "SearchButtonclick") $DownloadButton = GUICtrlCreateButton("Download", 296, 504, 297, 40, 0) GUICtrlSetOnEvent(-1, "DownloadButtonclick") $ProgressBar = GUICtrlCreateProgress(8, 504, 281, 17) $ProgressInfoLabel = GUICtrlCreateLabel("Progress Info", 8, 528, 200, 17) $SearchTermLimiter = GUICtrlCreateCheckbox("Include Search Terms in Filename", 320, 132, 277, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### FileTypeComboChange() While 1 Sleep(100) WEnd Func Progress($Percent, $Text) guictrlsetdata($ProgressBar, $Percent) guictrlsetdata($ProgressInfoLabel, $Text) EndFunc Func DownloadButtonclick() $SelectionIndex = _GUICtrlListView_GetNextItem($AvailableFilesListBox) $SelectedText = _GUICtrlListView_GetItemTextString($AvailableFilesListBox,$SelectionIndex) $LineArray = StringSplit($SelectedText,"|") $SaveFile = FileSaveDialog("Download File To...",@DesktopCommonDir,"","",$LineArray[1]) $Size = InetGetSize($LineArray[4]) Inetget($LineArray[4],$SaveFile,1,1) While @InetGetActive Progress(@InetGetBytesRead/$Size*100, Stringformat("%.2f", @InetGetBytesRead/1000) & " Kb") Sleep(250) Wend Progress(0,"Complete") EndFunc Func MainGUIClose() Exit EndFunc Func FileTypeComboChange() $TypeToFind = Guictrlread($FileTypeCombo) Select case $TypeToFind = "Music" Guictrlsetdata($ExtensionListEditBox, "mp3 mp4 wma ogg flac aiff raw au gsm dct vox aac m4a atrac ra ram msv dvf m4p") case $TypeToFind = "Movies" Guictrlsetdata($ExtensionListEditBox, "3gp asf asx avi mov mpg mpeg mp4 ogm qt rm swf flv vob wmv") case $TypeToFind = "Programs" Guictrlsetdata($ExtensionListEditBox, "msi exe zip rar app") case $TypeToFind = "Images" Guictrlsetdata($ExtensionListEditBox, "jpg jpeg bmp tiff tif raw png gif ppm pgm pbm pnm svg") case $TypeToFind = "CD/DVD Images" Guictrlsetdata($ExtensionListEditBox, "iso bin cue vob nrg dmg mds ccd dvd") case $TypeToFind = "Torrents" Guictrlsetdata($ExtensionListEditBox, "torrent") case $TypeToFind = "Archives" Guictrlsetdata($ExtensionListEditBox, "zip rar 7z") case $TypeToFind = "Documents" Guictrlsetdata($ExtensionListEditBox, "doc pdf odt txt rtf") case Else GUICtrlSetData($ExtensionListEditBox, "") EndSelect EndFunc Func SearchButtonclick() $Query = Guictrlread($SearchText) $FileTypes = guictrlread($ExtensionListEditBox) $Delimiter = " " $MaxResults = guictrlread($MaxResultsInput) if guictrlread($SearchTermLimiter) = $GUI_CHECKED then $LimitSearch = True Else $LimitSearch = False EndIf if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $MinimumFileSize = guictrlread($MinimumFileSizeEditBox) Else $MinimumFileSize = 0 EndIf if guictrlread($EnableProgressBar) = $GUI_CHECKED then $ProgressOn = true Else $ProgressOn = False EndIf $ResultArray = _GoogleFileFinder($Query, $FileTypes,$Delimiter, $MaxResults, $MinimumFileSize, $LimitSearch, $ProgressOn) for $i = 0 to ubound($ResultArray)-1 Progress(($i+1)/(ubound($ResultArray)+1)*100, "Result " & $i & " of " & ubound ($ResultArray)) if Stringinstr($ResultArray[$i],"http")> 0 and Stringinstr($ResultArray[$i],"intitle:")=0 and stringlen($ResultArray[$i])>0 then $Filename = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],"/","",-1)) $Type = Stringright($ResultArray[$i],stringlen($ResultArray[$i]) - stringinstr($ResultArray[$i],".","",-1)) $location = $ResultArray[$i] if stringlen($type) > 4 or $type = "" then $Type = "Unknown" if guictrlread($MinimumFileFilterEnable) = $GUI_CHECKED then $Size = StringFormat("%.2f", InetGetSize($ResultArray[$i])/1000000) & " MB" Else $Size = "N/A" EndIf _GUICtrlListView_InsertItem($AvailableFilesListBox,"",0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0,stringreplace($FileName, "%20", " "),0) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $size,1) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $type,2) _GUICtrlListView_AddSubItem($AvailableFilesListBox,0, $location,3) EndIf Next _GUICtrlListView_SetColumnWidth($AvailableFilesListBox,0,$LVSCW_AUTOSIZE) Progress(0,"") EndFunc func _GoogleFileFinder($Query, $FileTypes,$Delimiter = " ", $MaxResults = 10, $MinimumFileSize = 0, $LimitSearch = False, $ProgressOn = False) ;Minimum File Size is in Megabytes local $SearchURL, $GoogleHTML, $LinkArray, $FileArray, $FullFileList, $QueryArray local $FullHTML, $FileTypeArray, $FileLinkExtractionPattern, $TempHTML $FileTypeArray = StringSplit($FileTypes, $Delimiter) $QueryArray = StringSplit($Query, $Delimiter) $FileTypes = stringreplace($FileTypes, $Delimiter,"%7C") $Query = stringreplace($Query, $Delimiter,".") $SearchURL = "http://www.google.com/search?hl=en&q=intitle%3A%22index.of%22+%28" & _ $FileTypes&"%29+"& $Query &"+-html+-htm+-php+-js+-asp+-jsp&btnG=Google+Search&num=" & $MaxResults $GoogleHTML = _InetGetSource($SearchURL) $LinkExtractPattern = '(?i)href="(.*?)"' $LinkArray = StringRegExp($GoogleHTML, $LinkExtractPattern,3) Progress("","Finding Host Websites...") for $CurrentURL = 0 to ubound($LinkArray)-1 Progress(($CurrentURL + 1)/(ubound($LinkArray)-1) *100, "Limiting Searched Links: " & $CurrentURL+1 & " of " & ubound($LinkArray)) $GoogleIncluded = StringInStr($LinkArray[$CurrentURL],"google") $CacheIncluded = StringInStr($LinkArray[$CurrentURL],"cache") $GSearchIncluded = StringInStr($LinkArray[$CurrentURL],"/search?") if $GoogleIncluded = 0 and $CacheIncluded = 0 and $GSearchIncluded = 0 Then $TempHTML = _INetGetSource($LinkArray[$CurrentURL]) $TempHTML = StringReplace($TempHTML,'href="', 'href="' & $LinkArray[$CurrentURL]) $FullHTML = $FullHTML & $TempHTML EndIf Next For $CurrentType = 1 to ubound($FileTypeArray)-1 Progress(($CurrentType + 1)/(ubound($FileTypeArray)-1) *100, "Finding File Links: " & _ $CurrentType + 1 & " of " & ubound($FileTypeArray)-1) $FileLinkExtractionPattern = '(?i)href="(.*?)'&$FileTypeArray[$CurrentType]&'"' $FileArray = StringRegExp($FullHTML, $FileLinkExtractionPattern,3) for $TypeNum = 0 to ubound($FileArray) -1 $FileArray[$TypeNum] = $FileArray[$TypeNum] & $FileTypeArray[$CurrentType] Next $FullFileList = $FullFileList & _ArrayToString($FileArray,"|") & "|" Next $FileArray = "" $FileArray = StringSplit($FullFileList,"|") if $LimitSearch Then $LimitedFileList = "" For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 ) *100, "Limiting Search Results: " & $CurrentFile +1 & " of " & ubound ($FileArray)) $IncludeThis = False $HasHTTP = False if Stringinstr($FileArray[$CurrentFile], "http:")>0 then $HasHTTP = True for $CurrentQuery = 1 to ubound($QueryArray) -1 if Stringinstr($FileArray[$CurrentFile], $QueryArray[$CurrentQuery]) > 0 then $IncludeThis = True ExitLoop EndIf Next if $HasHTTP and $IncludeThis Then $LimitedFileList = $LimitedFileList & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($LimitedFileList,"|") EndIf if $MinimumFileSize > 0 then $FileSizeLimited = '' For $CurrentFile = 0 to ubound($FileArray) -1 Progress(($CurrentFile +1)/(ubound($FileArray) -1 )*100, "Checking File Size: " & $CurrentFile +1 & " of " & ubound($FileArray)) if $MinimumFileSize > InetGetSize($FileArray[$CurrentFile])/1000000 Then $FileSizeLimited = $FileSizeLimited & $FileArray[$CurrentFile] & "|" EndIf Next $FileArray = "" $FileArray = StringSplit($FileSizeLimited,"|") EndIf ProgressOff() return $FileArray EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now