0

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


enter image description here

Hackoo
  • 18,337
  • 3
  • 40
  • 70
  • If you would have used Google's image search yourself you'd have noticed initially i.e. only ~35 pictures are displayed. And only when scrolling further more are loaded. Which happens thru additional HTTP requests. Which you lack. – AmigoJack Aug 12 '20 at 19:16
  • 1
    There are no pages to count. Single scrolling page. So, maybe look to this approach... [Powershell Scroll down a webpage / Powershell Screenshot](https://stackoverflow.com/questions/26535311/powershell-scroll-down-a-webpage-powershell-screenshot) or using [PowerShell Selenium automation](https://duckduckgo.com/?q=powershell+selenium&t=hk&ia=web). – postanote Aug 12 '20 at 19:30
  • @AmigoJack So did you have any idea to how to get more additional HTTP requests ? – Hackoo Aug 12 '20 at 19:41

0 Answers0