Jump to content

[Alfred 3] Google Inline Search (open URL + copy to clipboard)


Recommended Posts

This workflow allows you to do inline Google searches right from the Alfred bar. You can either open the result URL or copy it to clipboard. Please go to GitHub for documentation

 

GitHub: https://github.com/aviaryan/alfred-google-search

Download: https://github.com/aviaryan/alfred-google-search/raw/master/Google Search.alfredworkflow

 

Screenshots

Default UI

Search 1

Unicode

 

 

 

Edited by aviaryan
Link to post

Yeah. If nothing is selected in the query box, and you haven't set a "copy text" for an item, ⌘C copies the selected item's arg.

 

BTW: You might want to add a copy of the .alfredworkflow file to your releases on GitHub. People generally expect to find the installable files in releases.

Edited by deanishe
Link to post
2 hours ago, deanishe said:

Yeah. If nothing is selected in the query box, and you haven't set a "copy text" for an item, ⌘C copies the selected item's arg.

1

Cool. I didn't know we had a copy text parameter. Any place where I can find all this documented?

 

2 hours ago, deanishe said:Yeah. If nothing is selected in the query box, and you haven't set a "copy text" for an item, ⌘C copies the selected item's arg.

BTW: You might want to add a copy of the .alfredworkflow file to your releases on GitHub. People generally expect to find the installable files in releases.

Yes. I had been including the binary in the releases in my previous 2 workflows. Just got a bit lazy this time. I have added it now. 

Link to post
9 minutes ago, aviaryan said:

Any place where I can find all this documented?

 

https://www.alfredapp.com/help/workflows/inputs/script-filter/json/

 

See the "text" section. Also the example workflow you can add via Alfred Preferences > Workflows > + > Getting Started > Script Filter shows most of what you can do (it doesn't demonstrate rerun or variables).

Link to post
  • 2 months later...
  • 1 year later...
18 hours ago, bazerman said:

Anyone using this successfully with Alfred 4?

 

It works for me, but with this important caveat:

 

Quote

Overusing this workflow might lead to your IP being blocked by Google Search servers. Searches through Chrome or another browser might still work but this workflow will stop working. I recommend keeping a 10-15 seconds gap after each usage of this workflow. In most cases, much lower gaps or even continuous use of the workflow will still work but still this is something to be kept in mind. If you see a 'rate limit' or a 503 error, it's best to stop using the workflow and try back after some time (~1 minute).

 

The rate limit makes the workflow unfeasible for my routine.

Link to post
1 hour ago, xilopaint said:

Really? This workflow worked for me.

 

For me, Google isn't sending the HTML markup the workflow expects. This parser is looking for the same tags as the other workflow's.

 

The problem is that Google doesn't give everybody the same HTML, or the same person the same HTML at different times. Changing the user agent can get you a completely different page.

 

I suspect such a workflow might have more luck with a user agent like Lynx/2.8.5dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7a. That gets you a really old-school version of the page that hasn't changed in 15 years (and probably won't change).

 

Link to post

I used to use a few different modified versions of this workflow, to return results for specific sites (prefix site:site.com). It was indispensable, but now, I am definitely rate-limited / blocked, and I can't seem to get it to work anymore, even from different IP addresses. 

 

Does anyone have a recommendation for where to begin on replacing such functionality? I tried modifying @deanishe's Searchio! workflow, but I think the suggest URL doesn't work after adding in my site: prefix. 

 

 

Link to post
10 minutes ago, joeynotjoe said:

but I think the suggest URL doesn't work after adding in my site: prefix

 

In theory, you could edit the search URL for the results page to add your site:xyz.com, but you can't have suggestions for a specific site. And anyway, it only provides suggestions, not results like this workflow does.

 

13 minutes ago, joeynotjoe said:

I can't seem to get it to work anymore, even from different IP addresses

 

That probably won't help. Google seems to have changed the HTML of the results page (for some users at least).

Link to post

Ah you are right, thanks for pointing that out. I missed the fundamental distinction between results and suggestions. So essentially, this workflow will need to be refactored to support the new HTML results if that's possible, otherwise, go back to the dark ages of opening the results page before going to what I want :). 

Thanks for the quick response!  

Edited by joeynotjoe
typo
Link to post
23 hours ago, joeynotjoe said:

this workflow will need to be refactored to support the new HTML results if that's possible, otherwise, go back to the dark ages of opening the results page before going to what I want :). 

 

🤞️ - was one of my favourites! Huge timesaver

Link to post
  • 1 month later...
  • 4 months later...

@vitor - Searchio! is great, but the main difference was, as far as I can tell, actioning the searchio 'results' takes you to the google results page, whereas actioning this workflow's results actually took you to the result's URL.

 

aviaryan's workflow's results:

68747470733a2f2f692e696d6775722e636f6d2f

Searchio's results:

iWFiAnI.png

So, the original workflow from this thread is 'better' if you know what you're looking for - it saves you the step of going to the google page.

Link to post
  • 2 months later...
On 7/4/2019 at 5:39 PM, bazerman said:

As a non developer, what would be the learning curve like if I was to take this on myself and try to fix the HTML parsers?

 

Scraping HTML ranges from pretty simple to really complex, depending on what you're trying to scrape. Scraping Google results isn't technically difficult. The problem is that they change the website frequently, which breaks the workflow. They also have a lot of defences in place to prevent scraping.

 

2 hours ago, bazerman said:

do you feel google changes this stuff too often?

 

I've had some luck scraping Google by sending a really old user agent. They did change the HTML last year, but it was stable for a long time before that. The page looked to be straight out of 2005.

 

Link to post

Thanks Deanishe, makes sense.

 

I wonder if there's an alternative search engine that's more stable to build an in-line search workflow from. I'm honestly surprised this isn't at the top of everyone's lists, it seems like one of the most obvious and effective uses of alfred! 

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