pacmax beta

Alfred Pac by deanishe on GitHub

Alfred Searchio

Alfred workflow to auto-suggest search results from multiple search engines and languages.

From their README

Searchio! workflow for Alfred

Auto-suggest search results from multiple search engines and languages.

Searchio! Demo

Contents

Supports the following search engines/websites:

  • Amazon
  • Bing
  • DuckDuckGo
  • DuckDuckGo Image Search
  • eBay
  • Google
  • Google "I'm Feeling Lucky"
  • Google Images
  • Google Maps (requires a Google Places API key)
  • Naver
  • Wikia (only the top ~200 wikis, but you can import any others)
  • Wikipedia
  • Wiktionary
  • Yandex
  • YouTube
  • plus it can import a search configuration from any website that supports OpenSearch autosuggestions

Download and installation

Download the latest version from the GitHub releases page.

Usage

There are several example searches pre-configured:

  • g — Search Google in English
  • gd — Search Google in German
  • w — Search the English Wikipedia
  • wd — Search the German Wikipedia
  • yt — Search the United States version of YouTube
  • ytd — Search the German version of YouTube

Configuration

The workflow is configured via the searchio keyword and some workflow variables set in the workflow configuration sheet.

Workflow Configuration Sheet

There are some variables in the workflow configuration screen (open the workflow in Alfred Preferences and hit the [𝒙] button):

Name Description
ALFRED_SORTS_RESULTS Set to 1 or yes to enable Alfred's knowledge. Set to 0 or no to always show results in the order returned by the API.
GOOGLE_PLACES_API_KEY You must set this to use Google Maps search. You can get an API key here.
SHOW_QUERY_IN_RESULTS Set to 1 or yes to always append the entered query to the end of the results (so you can hit ↑ to select it). If unset (or set to 0 or no), the query will only be shown if there are no other results.

In-Workflow Configuration

  • searchio [] — Show workflow settings
    • Update Available … — Shown if there is a new version of the workflow available to download. Action the item to install it.
    • Installed Searches … — View and delete your configured searches
    • All Engines … — View supported engines and add new searches
    • Import Search … — Import a new search configuration from a URL (see Importing Searches)
    • Reload — Regenerate the workflow's Script Filters from your configured searches (and clean the cache). Run this if you screw up the Script Filters or an update overwrites them.
    • Show Query in Results — Turn the option to show the query you entered in the results on/off. The query is added to the end of the results, so you can hit ↑ to go straight to it. The query is always shown if there are no other results.
    • Alfred Sorts Results — Turns Alfred's knowledge on/off. If on, Alfred remembers which result you chose for which query and moves that result to the top. If off, results are always shown in the order they are returned by the API. If on, Show Query in Results cannot guarantee that the query is always the last result.
    • Online Help — Open this page in your browser.
    • Workflow up to Date — You have the latest version of the workflow. Action this item to force a check for a new version.

Importing Searches

Searchio! has the ability to import a search configuration from any website that supports the OpenSearch autosuggestion API.

Run searchio > Import Search … and the workflow will offer to import a search from a URL on your clipboard, the frontmost Safari tab or the frontmost Chrome tab.

It will try to find and read the OpenSearch description at the URL and import it (and the website's icon if available), then ask you to assign a keyword for the search.

NOTE: Although many websites support OpenSearch, few support the autosuggestion API that Searchio! uses. Sites based on MediaWiki usually support the API, so you can add all your favourite Wikia wikis (the built-in Wikia engine only supports the few hundred most popular wikis).

Adding Engines

In addition to the built-in engines, you can add your own definitions in the engines folder in the workflow's data directory. (Enter searchio workflow:opendata to open the data folder in Finder.)

An engine definition looks like this:

{
  "description": "Alternative search engine",
  "jsonpath": "$[*].phrase",
  "title": "DuckDuckGo Images",
  "pcencode": false,
  "variants": [
    {
      "name": "Argentina",
      "search_url": "https://duckduckgo.com/?iax=images&ia=images&kp=-2&kz=-1&kl=ar-es&q={query}",
      "suggest_url": "https://duckduckgo.com/ac/?kp=-2&kz=-1&kl=ar-es&q={query}",
      "title": "DuckDuckGo Images Argentina",
      "uid": "ar-es"
    }
  ]
}

title and description are self-explanatory. jsonpath is the JSON path expression that extracts the search suggestions from the JSON returned by the suggestion API.

The optional pcencode field tells Searchio! to percent-encode the search query rather than use plus-encoding (the default).

variants define the actual searches supported by the search engine, typically one per region or language. All fields are required. suggest_url points to the autosuggestion endpoint and search_url is the URL of the search results that should be opened in the browser. Both URLs must contain the {query} placeholder, which is replaced with the user's search query.

The (optional) icon for your custom engine should be placed in the icons directory alongside the engines one. It should have the same basename as the engine definition file, just with a different file extension. Supported icon extensions are png, icns, jpg and jpeg.

Licensing, thanks

The code in this workflow is released under the MIT Licence.

The icons belong to the respective search engines and websites.

This workflow uses the following libraries:

Latest release

  • 2.0.18 years ago, 3.6 MBDownload

    Correct JSON path for imported (OpenSearch) searches

17 earlier releases
  • 2.0.08 years ago, 3.6 MBDownload
    • Add DuckDuckGo image search #40
    • Add option to turn off Alfred's knowledge #49
  • 2.0.0-rc28 years ago, 4.5 MBDownload
    • Leave space to left of generated Script Filters #31
    • Autocomplete to suggestion + " " #32
    • Add option to append query to results #33
    • Fix locales for Portuguese (thanks to @xilopaint)
  • 2.0.0-rc18 years ago, 2.7 MBDownload
    • Searches can now be added and deleted from within the workflow itself (the workflow rewrites its own info.plist)
    • Searches can be imported from websites that support the OpenSearch autosuggest API
    • Search is now performed via a Go program, which is 3–20x faster than the Python version
  • 1.118 years ago, 718 KBDownload

    Fixes #23, #24 and #25

    Thanks to @schrodincat

  • 1.109 years ago, 819 KBDownload

    Added by @schrodincat in #21

  • 1.99 years ago, 808 KBDownload

    Add Google's "I'm Feeling Lucky" search thanks to @duqcyxwd #16

  • 1.8.110 years ago, 738 KBDownload

    Fixes #3

  • 1.811 years ago, 737 KBDownload
    • Add support for Wikia.com wikis
    • Update Alfred-Workflow

    To search a Wikia wiki, provide the subdomain as the --lang option in the Script Filter, e.g. to search the Borderlands wiki at http://borderlands.wikia.com, use:

    /usr/bin/python search.py -e wikia -l borderlands "{query}"
    
  • 1.711 years ago, 690 KBDownload
    • Add support for Naver.com search suggestions
    • Update Alfred-Workflow
  • 1.6.111 years ago, 640 KBDownload
    • Connect Yandex example to Open URL
  • 1.611 years ago, 640 KBDownload
  • 1.511 years ago, 607 KBDownload
    • Fix Wikipedia/Wiktionary API
    • Add self-updating
    • Add space after query on autocomplete
  • 1.412 years ago, 584 KBDownload

    Thanks to @vitorgalvao for finding and fixing the bug.

  • 1.312 years ago, 584 KBDownload

    Hitting TAB on results will expand Alfred's query to that search phrase.

  • 1.212 years ago, 584 KBDownload

    New search engines:

    • Amazon
    • eBay
    • Google Images
    • Google Maps
    • YouTube
  • 1.112 years ago, 358 KBDownload

    Add optional setting to show the query in the suggestions list

  • 1.012 years ago, 359 KBDownload