#################################### # Google Parser + Mp3 Searcher # # Coded By Yusuf Ozturk # # http://www.yusufozturk.info # #################################### [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') # For Interactive Input Box # Search Input $SearchInput = [Microsoft.VisualBasic.Interaction]::InputBox("What are you looking for?", "Song/Singer Name", "Gece icinde sakli") # Split to Keywords $Keyword = $SearchInput -Replace "\s","+" # For searching $Keyword = $Keyword + "+rapidshare.com+mp3" # Look for Rapidshare Links $Keywords = $Keyword.Split("+") # For checking purposes # Where Could We Write? $Location = "C:\Search" # Lets Check Location Directory If ((Test-Path -Path $Location) -ne $True) { New-Item $Location -Type Directory } # Search Outputs $Search = "$Location\Search.txt" $Results = "$Location\Results.txt" $Temp = "$Location\Temp.txt" # Lets Make Google Search $Url = "http://www.google.com.tr/search?hl=tr&source=hp&q=" + $Keyword + "&start=0" $Webclient = New-Object System.Net.WebClient $Webpage = $Webclient.DownloadString($Url) $Webpage > "$Search" $Url = "http://www.google.com.tr/search?hl=tr&source=hp&q=" + $Keyword + "&start=10" $Webclient = New-Object System.Net.WebClient $Webpage = $Webclient.DownloadString($Url) $Webpage >> "$Search" # Get Web Results and Parse Web Links $Hostname = Select-String "$Search" -Pattern 'http://' $Hostname = [Regex]::Matches($Hostname, '> "$Location\$Timestamp-$ID.txt" # Check Keywords in Web Sites $Status = "True" Foreach ($Keyword in $Keywords) { $Checking = Select-String "$Location\$Timestamp-$ID.txt" -Pattern "$Keyword" If(!$Checking) { $Status = "False" } } If ($Status -eq "False") { Write-Host "No Match!" -ForegroundColor Red } Else { Write-Host "Matched!" -ForegroundColor Green $Webpage >> "$Results" } } # Get Links and Control with Rapidshare API $LinkControl = Select-String "$Results" -Pattern 'http://' $LinkControl = [Regex]::Matches($LinkControl, 'href="http://rapidshare.com/files/([^"]+)"') $RapidID="0"; Foreach ($RapidLink in $LinkControl) { $RapidLink = [String]$RapidLink $RapidLink = $RapidLink.Substring(6) $RapidLink = [String]$RapidLink[0..($RapidLink.Length-2)] -Replace "\s","" Write-Host $RapidLink #Link Checker with Rapidshare API $RapidLink = $RapidLink.Substring(7) $Files = $RapidLink.Split("/")[2] $Filenames = $RapidLink.Split("/")[3] $Url = "http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files=" + $Files + "&filenames=" + $Filenames $Webpage = $Webclient.DownloadString($Url) $RapidID=[int]$RapidID+1; $LinkCheck = "$Location\Rapid-$Timestamp-$RapidID.txt" $Webpage > "$LinkCheck" $LinkResult = Select-String "$LinkCheck" -Pattern "$Files" $LinkResult = $LinkResult.Get_Line() $Status = $LinkResult.Split(",")[4] If ($Status -eq "1") { $RapidLink = "http://" + $RapidLink Add-Content -Path “C:\SearchResults.txt” -Value $RapidLink } }