Jump to content
Triplex79

WebSearch with multiple URLS -> One {query} - SOLVED/SOLUTION

Recommended Posts

Posted (edited)

Hello together,

 

1. i am totally new to workflows. I think what i want achieve, i could do with workflows. But i don't know how to accomplish that.

I want to open with one {query} -> already what i use -> for instance Google Maps search -> open multiple pages.

 

How is that possible?

 

2. How is it possible in addition top copy (to the clipboard) the opened URL's -> we opened through the workflow? All three at once, in case there are three

URLs that should be opened.

 

Thank you very much for your help!

 

EDIT/Solution: If somebody face the same problem, Vitor had for me the solution created

Thank you very much again Vitor!

 

Edited by Triplex79
Solution Added

Share this post


Link to post

Welcome @Triplex79,

 

Can you better explain what you want to accomplish and what are the steps? Typically one uses arrows to describe the next step in a sequence, but yours seems to be describing the same thing. I didn’t understand at all what you want.

 

What is your native tongue?

Share this post


Link to post

native tongue is German.

But English is not a problem usually. 

 

I contacted the support already, he did understood me :D

 

Party i was already some steps closer. But still something is missing.

 

O.K. requirements are:

 

  1. I open with a keyword and a {query} and the same query will open three pages like in the standard workflow to see
  2. image.png.c8380e00bd4b35daf5375652c9178eb1.png
  3. What now is missing for me, i need Alfred copy the final URL that is stated in the browser URL bar for all websites (after possible redirects)

Do you know a script how i may accomplish that?

 

Thank you in advance!

Share this post


Link to post
2 hours ago, Triplex79 said:

i need Alfred copy the final URL that is stated in the browser URL bar

 

Why? What are you trying to achieve? It’s easier to resolve URLs redirects in code than trying to get them from browser tabs that may or may not have finished loading yet. 

Share this post


Link to post
1 hour ago, deanishe said:

 

Why? What are you trying to achieve? It’s easier to resolve URLs redirects in code than trying to get them from browser tabs that may or may not have finished loading yet. 

I want to get copied all URLS after the redirect to my clipbloard like:

 

http://www.domain1.com/

http://www.domain2.com/

http://www.domain3.com/

 

But exactly like they are after the redirect (if any apply)

 

And then i have the URLS in my clipboard. 

 

Share this post


Link to post
Posted (edited)
16 minutes ago, Triplex79 said:

And then i have the URLS in my clipboard

 

So you don't actually want to open them in a browser? You just want to resolve any redirects and copy the canonical URLs to the clipboard?

 

You can resolve redirects with the following Python code:

from urllib2 import urlopen

# URL to resolve
url = 'http://www.google.com'

r = urlopen(url)

# URL after any redirects
newurl = r.geturl()

 

Edited by deanishe

Share this post


Link to post
Posted (edited)
4 minutes ago, deanishe said:

 

So you don't actually want to open them in a browser? You just want to resolve any redirects and copy the canonical URLs to the clipboard?

 

You can resolve redirects with the following Python code:


from urllib2 import urlopen

# URL to resolve
url = 'http://www.google.com'

r = urlopen(url)

# URL after any redirects
newurl = r.geturl()

 

Of course i open them like in the screenshot above in the browser. 

 

1. I use a keyword that replace the query variable {query} execute a search

2. 3 tabs will open with different URLS all the same query in it - same like the movie search template in workflows Alfred already offer

3. Now i want that Alfred copy all URL's to my clipboard like i wrote above 

 

Edited by Triplex79

Share this post


Link to post
2 minutes ago, Triplex79 said:

Of course i open them like in the screenshot above in the browser.

 

I didn't ask if you are opening them: I can see that. I asked if you want to open them.

 

Or do you just want to have the URLs on the clipboard, and the browser tabs are a side-effect of the way you've tried to build the workflow?

Share this post


Link to post
Just now, deanishe said:

 

I didn't ask if you are opening them: I can see that. I asked if you want to open them.

 

Or do you just want to have the URLs on the clipboard, and the browser tabs are a side-effect of the way you've tried to build the workflow?

 

Oh, ok sorry!

Yes i want them to opened and afterwards the clipboard copy 🙂

Share this post


Link to post

This is pretty easy to do in code, but not via browser automation they way you have it set up.

 

It looks like you have three URLs opening in two different browsers.

 

 

Share this post


Link to post
2 minutes ago, deanishe said:

This is pretty easy to do in code, but not via browser automation they way you have it set up.

 

It looks like you have three URLs opening in two different browsers.

 

 

Three URLS in 3 browser tabs -> one browser

Share this post


Link to post

I feel like there’s some information we’re not getting. As in, why would the URLs redirect? Why can’t you just include the URLs in their final form to begin with?

 

Either way, try this Workflow. It should do what you want.

 

It works by first making a web request and getting the final redirect, and only then opening them in the browser (makes double the web requests, but is way easier to build than the other way around). It will copy all URLs to the clipboard separated by newlines. If you want to change the URLs, open the Run Script and change the starting lines in quotes (lines 2–4). Keep the same pattern: in double quotes, and use ${1} for the place where your query will be substituted.

Share this post


Link to post
15 hours ago, vitor said:

I feel like there’s some information we’re not getting. As in, why would the URLs redirect? Why can’t you just include the URLs in their final form to begin with?

 

Either way, try this Workflow. It should do what you want.

 

It works by first making a web request and getting the final redirect, and only then opening them in the browser (makes double the web requests, but is way easier to build than the other way around). It will copy all URLs to the clipboard separated by newlines. If you want to change the URLs, open the Run Script and change the starting lines in quotes (lines 2–4). Keep the same pattern: in double quotes, and use ${1} for the place where your query will be substituted.

 

Exactly what i wanted!

Really cool 🙂

 

It works perfectly, thank you very much!

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...