I want to extract from Google image Search all images hyperlinks , but the maximum of images that i got with this powershell script is about 90 no more ?
I want to get more results, so for this reason i'm looking for a way to find the total number of pages ? Hope that somone have a trick for this !
$QueryString = Read-Host 'Please type any keyword for searching its image with google :'
$QueryString = $QueryString.replace(" ","+")
#Write-Host "searching for this $QueryString"
$url = "https://www.google.com/search?q=$QueryString&tbm=isch"
$http_request = New-Object -ComObject Microsoft.XMLHTTP
$http_request.open('GET', $url, $false)
#Sending the request
$http_request.send()
$Contents = $http_request.ResponseText
$pattern = "(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&/~\+#]*[\w\-\@?^=%&/~\+#])(\.jpg|\.gif|\.jpeg|\.png|\.tiff|\.bmp)"
$Images_Link = $Contents | Select-String $pattern -AllMatches | ForEach-Object {$_.Matches.Value} | sort -unique
$c=0
Foreach ($Img in $Images_Link)
{
$c=$c+1
Write-Host $c - $Img
}
I made before a HTA with vbscript Google Image Search.hta but i'm still stuck to load more images