Jump to content
nikivi

Web Searches - Search on any website from Alfred

Recommended Posts

Posted (edited)

This is my first ever workflow with actual code in it.¬†ūüéä

 

The workflow searches a big list of websites that can be found here similar to DuckDuckGo Bang operators. If you wish to extend it, you can do it.

 

The latest download of the workflow can be found here together with a README that contains the instructions on how to best use it.

 

However there is one major problem in that currently the workflow does not allow me to fuzzy search on the websites. I don't really know how to implement it. I based most of the workflow on Safari Assist workflow made and shared by @deanishe and use the same library too which turns out is quite awesome.

 

It also misses auto updating mechanism. Will try to figure out how to add that too. 

 

Also in the future I hope to add my own logo, I would love to have a similar style logos made similar to what @vitor is doing + I hope to add a way to attach an image to a prefix. So for example r: prefix will have Reddit logo.

 

First though I need to fix the fuzzy searching as that is the main reason why I made the workflow in the first place.

 

I hope you like it.¬†ūüíõ

Edited by nikivi

Share this post


Link to post
18 hours ago, nikivi said:

fix the fuzzy searching

 

It's built into the library.

 

Also, I broke your workflow, I'm afraid. I refactored AwGo quite dramatically yesterday. Next time you pull the library, your workflow won't compile without changes.

Share this post


Link to post
Posted (edited)

Thank you @deanishe

 

This version now has fuzzy searching + it has a logo I made for it (not the best logo in the world), I will change it later. :) 

 

There is ~ 250 searches now there and I hope the list grows in the future to include any kind of website one can want to search for. 

 

Here you can find the latest download. I also should add auto update functionality, will try to add that. AwGo is a really awesome library.¬†ūü¶Ą

Edited by nikivi

Share this post


Link to post

Hey @deanishe, is it possible to add a learning feature too in the library. I searched for 'learn' in Godoc and did not find anything. I want the workflow to learn from user's inputs similar to what Alfred provides with List Filters.

 

Thank you. 

Share this post


Link to post
4 hours ago, nikivi said:

I want the workflow to learn from user's inputs similar to what Alfred provides with List Filters.

 

Alfred already does that. As long as you give your results a UID. 

Share this post


Link to post
Posted (edited)

Updated the workflow to now include icons for each of the prefixes. Plus a rather neat default icon. 

 

You can grab the latest update from GitHub.

 

There is few issues though I have to solve. First, the fuzzy searching is acting really weirdly in regards to 'r: machine learning' option. For example why is machine learning the top pick when I type 'la' : 

 

zZWnwSd.png 

 

Not really sure why that happens but 'r: machine learning' seems to dwarf most of the queries I do for some reason.

 

And also I could not figure out how to add auto updating mechanism. I looked at all the repos using AwGo and they use it together with a big options struct. I tried to emulate that but I am certain that does not work. I looked into Updater and how it was implemented but still find it a bit confusing + I don't really know how to test if it works, I guess by faking a release and looking at a debugger but not sure.

 

Also I am struggling with extending this workflow with modifiers. For example I managed to get control modifier to work on results with 'r: ' prefix to scope the search to 'this week'. But I can't find a solution to have it scale without adding a ton of objects in Alfred. Ideally I would love to do this all through code if possible but I find working with Variables super messy. Will try to look into Alfred SSH and other repos though, perhaps I will find a way.

 

On the bright side, this workflow is looking pretty neat, I actually swapped all my static searches and will be now using this going forward. Since it's super easy to extend it too, would be lovely if community helps extend it.

 

Also I am not quite sure how to speed this up. I guess I can try to save the JSON AwGo builds with its Feedback mechanism and then have Alfred read that instead.

Edited by nikivi

Share this post


Link to post
9 hours ago, nikivi said:

I looked at all the repos using AwGo and they use it together with a big options struct.

 

I told you I refactored the API. The options structs are gone. Looking at workflows built with older versions of the library won't help. There's a full example included with the library. I can hardly make it any easier than that.

 

9 hours ago, nikivi said:

Also I am not quite sure how to speed this up.

 

seriously-meme-face.png 

 

Share this post


Link to post
Posted (edited)

Yeah you are right that it is quite fast now. But since I plan to include every *useful* website on Earth to be searchable through it, I think it will make sense later to not have the workflow read and parse the CSV every time it is ran. 

 

I will also try rewriting Searchio in Go as that is my most used workflow and any speed gain there would be super useful plus I would love to add more options like Quora searching as well as modifier supports for scoping searching to 'by week' 'by month' and so on.

 

 

Edited by nikivi

Share this post


Link to post
12 minutes ago, xilopaint said:

How the workflow works?

 

For some bizarre reason, @nikivi hasn't assigned a keyword (or title) to the Script Filter. Either add your own keyword or configure the Hotkey.

Share this post


Link to post
Posted (edited)
36 minutes ago, xilopaint said:

How the workflow works? I don't get to do a search.

 

Yeah as @deanishe said, you have to assign a hotkey to use the workflow.

 

The reason I don't include keyword (or title) is because I always strip that information from all the workflows I use to have more clean Alfred prompts and since I always know what the workflow does anyway I find that information unnecessary for me.

 

However I will probably have to add that information to the keyword (title) I guess since other users can be confused by it too. It's just I run all my workflows from hotkeys and never use the alfred global search prompt and I really dislike how the Title text flashes for a brief moment when I activate workflow from a hotkey. 

 

So yeah, either I have to before each release of the workflow, add manually the keyword and title, release the workflow and then strip them for my own personal use or not add them at all. Ideally I wish everyone just used hotkeys for everything but not many people are into keyboard customisation and rebinding as me. :( 

Edited by nikivi

Share this post


Link to post
1 hour ago, nikivi said:

I will probably have to add that information to the keyword

 

That's probably a good idea for published workflows.

Share this post


Link to post

Added a small but very useful change to the workflow.


There is a new hotkey trigger that will take the selected text and then let you search that text on any of the websites available. I use that a lot now.


Can grab the latest release from GitHub.


I couldn't figure out how to add GitHub auto updating as the example deanishe provides is using docopt for argument parsing and I use kingpin and when I tried to use docopt, it was really confusing. I wish I could just use vitor's OneUpdater but I don't think I can in this kind of workflow.


I also want for the workflow to grab the latest CSV from GitHub and periodically download it locally to user's machine, will try to add that too soon.

Edited by nikivi

Share this post


Link to post
Posted (edited)

In fact this became my favourite workflow now.¬†ūüé䬆

 

After my mind's workflow, github jump, safari assist and searchio. 

Edited by nikivi

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×