Skip to content

Instantly share code, notes, and snippets.

@critterandguitari
Created June 3, 2015 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save critterandguitari/de42c43e6d29cc315a54 to your computer and use it in GitHub Desktop.
Save critterandguitari/de42c43e6d29cc315a54 to your computer and use it in GitHub Desktop.
retrieve image from google image search

This flow preforms a Google image search with the injected string, extracts the image URL from the returned JSON, makes another request for the image itself, and saves it locally.

[{"id":"f294910.f0d6b7","type":"http request","name":"","method":"GET","ret":"obj","url":"https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q={{payload}}&start=1&userip=MyIP","x":183,"y":173,"z":"81ae8e74.7e517","wires":[["e4eb0650.1b14f8"]]},{"id":"f3c9477d.0c36b8","type":"inject","name":"get image","topic":"","payload":"critter","payloadType":"string","repeat":"","crontab":"","once":false,"x":99,"y":84,"z":"81ae8e74.7e517","wires":[["f294910.f0d6b7"]]},{"id":"ba89cb7c.457638","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":593,"y":393,"z":"81ae8e74.7e517","wires":[]},{"id":"e4eb0650.1b14f8","type":"function","name":"","func":"msg.url = msg.payload.responseData.results[0].url;\n\nreturn msg;","outputs":1,"valid":true,"x":280,"y":253,"z":"81ae8e74.7e517","wires":[["e2bd1b10.1d42e8"]]},{"id":"e2bd1b10.1d42e8","type":"http request","name":"","method":"GET","ret":"bin","url":"","x":399,"y":339,"z":"81ae8e74.7e517","wires":[["ba89cb7c.457638","5a301d20.a5cfe4"]]},{"id":"5a301d20.a5cfe4","type":"file","name":"save image","filename":"image","appendNewline":false,"overwriteFile":"true","x":593,"y":301,"z":"81ae8e74.7e517","wires":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment