Jump to content
Yuri

Search in one site with keywords list

Recommended Posts

Hi, I am a designer and for my job I need sometimes to find a bunch of pictures for my design presentation.

I've read several thread regarding this but I think I am still clueless as to how it works. Maybe just need some one to point me to the right direction.

 

What I am looking for:

 

I have a small list (10-15 words) with keywords on txt file:

    one

    two

    three

    ...

    ten

 

And there is one site which I want to open in standard browser (safari) with this list of urls: 

    https://www.shutterstock.com/search/one

    https://www.shutterstock.com/search/two

    https://www.shutterstock.com/search/three

    ...

    https://www.shutterstock.com/search/ten

 

What is the best way to do it?

Any help would be appreciated.

Edited by Yuri

Share this post


Link to post

Quite simple to do, you need only loop through each line and tell them to open (when given a URL, this will open in the default browser):

IFS=$'\n' # to prevent problems if a line has more than one word separated by spaces

for line in $(cat '/path/to/file'); do
  open "https://www.shutterstock.com/search/${line}"
done

Made it into a workflow. It uses a File Action, so select the txt file you want and pick quickopen.


Give it a try and see if there’s something you’d like a bit differently or a more detailed explanation.

Edited by vitor

Share this post


Link to post

Wow! Thank you! It works well. I am going to buy you a beer :-)

 

How can I add time lag 1-2 seconds between requests?

Share this post


Link to post
7 hours ago, Yuri said:

Wow! Thank you! It works well. I am going to buy you a beer :-)

 

Thank you, I appreciate it.

 

7 hours ago, Yuri said:

How can I add time lag 1-2 seconds between requests?

 

You simply add a sleep 1 (or however many seconds you want) line inside the loop.

 

I’ve uploaded a new version of the workflow that adds a two second delay but also adds URL escaping (in case you ever have non-ASCII characters in your file, it will still work).

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...