Get Image URL/Address from webpage selection using Applescript/Javascript
I need a quick way to get the image URL, just like I would get if I right click on an image and select "Copy Image URL". I'm thinking Applescript, though others have mentioned Javascript.
This needs to be compatible with an Automator workflow and needs to work with Google Chrome, Chromium, and Safari, at a minimum.
More specifics:
1. I already have an Automator workflow that this will be added to.
2. The workflow begins with text and images that I have selected on a webpage using the mouse.
3. The processing of the text is working fine.
4. I just need a Applescript or Javascript or Shell Script (which I assume are the only outside code that can be added to an Automator workflow) that will grab any and all image URL's within the part of the page selected in step 2.
5. Images are NOT downloaded. Only the image URL is needed.
The basic logic is this:
Does selected input contain images?
If yes,
get URL of image(s)
pass URL(s) to the next step
else continue
(Asked recently, but probably didn't explain it well)
Any help or ideas appreciated!
OS X Yosemite (10.10.4), 2.4GHz, 8GB Ram, 1TB HD, 256G SSD