Scripting a non gui internet search and download for .icns files

Does anyone know if this is possible? I’m trying to find a way to automate the creation of AppleScript touchbar buttons and their contents so I have all of my plugins available on the Touch Bar.

I have a list, each item contains a list with a developer name and a plug-in name. I want to iterate through the list and perform an internet search using the dev and plug name as variables + “.icns” then download the the first 5 or so .icns images in the results. I don’t know if it’s possible with AppleScript alone, perhaps there’s a cli app that numbers search results and provides a url I could use with wget?

I’m sure you have your reasons to support Touch Bar on an older machine, but just in case: are you aware that Apple discontinued Touch Bar in 2021?

Well, you could build a search URL, then do shell script to call curl (CLI command) with that URL, then process the resulting HTML returned to pull out the links to images.
Example URL that does an Image Search:
https://www.google.com/search?q=developer+plugin+icns&tbm=isch
But, that won’t guarantee you get actual .icns files, although you could parse the results for that. Google also has a Search API, which probably would be much easier to parse results from than a raw HTML file, plus give you more control over what it searches for, perhaps even specific file type (.icns).

oops i just learned that Apple still keeps Touch Bar on its new M2 MBP 13" as they didn’t seem to bother to redesign it unlike other models. so i stand corrected - although it’s unlikely that Touch Bar has any future.