├── .gitignore ├── LICENSE ├── README.md ├── screenshots ├── amazon.png ├── baidu.png ├── bangumi-all.png ├── bangumi-anime.png ├── bilibili.png ├── bravesearch.png ├── duckduckgo.png ├── google.png ├── imdb.png ├── joybuy.png ├── moegirlpedia.png ├── pixiv.png ├── taobao.png ├── wikipedia-en.png ├── wikipedia-zh.png ├── wolframalpha.png └── zhihu.png └── src ├── 09DA712F-72B1-49D8-ADC6-F11C4DDB9B8C.png ├── 186480B7-9F2F-43AD-9994-A9B8E053ADE5.png ├── 3444F1D5-FE79-4B5F-A37D-DAA45D7D02F0.png ├── 471DBE2A-EC46-474C-9309-B78272DF472E.png ├── 63F60794-BB56-4415-9372-BAF974C3A7E1.png ├── 66323B0D-F24D-4F0C-BCB2-42D2BFA92C0F.png ├── 67D1CDF9-CA40-4D8E-B66C-E0FF18FCE3CE.png ├── 702E9582-5E02-4094-9889-0C4A575F7DAF.png ├── 7999A242-8DB6-41F9-BAD7-78C3E4CC0C41.png ├── 7C5A1AA4-8766-42A7-ADC5-6B91963B3CD9.png ├── 80FCED49-07AA-4C15-9B49-24A52B3AF5D6.png ├── 861BE674-55FF-4779-A44A-A02FF66440B0.png ├── A66D4C48-6D6D-4531-AF51-8463E488EEB2.png ├── AE15F1F6-37B0-4A47-BEE1-975354A81227.png ├── B1C4E5F1-FE5D-4505-9AD6-3F12A4F4ACC8.png ├── amazon.php ├── baidu.php ├── bangumi.php ├── bilibili.php ├── brave.php ├── duckduckgo.php ├── google.php ├── icon.png ├── imdb.php ├── info.plist ├── joybuy.php ├── moegirlpedia.php ├── pixiv.php ├── taobao.php ├── util ├── download.php └── request.php ├── vendor └── joetannenbaum │ └── alfred-workflow │ ├── Result.php │ └── Workflow.php ├── wikipedia.php ├── wolframalpha.php └── zhihu.php /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Ziqiu Zhu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Alfred Web Search Suggest 2 | 3 | Alfred search suggest workflow for various popular websites. Inspired by the official Google Suggest workflow. 4 | 5 | ## Download & Install 6 | 7 | ✨ This workflow is available on official Alfred Gallery now! (which means it has been reviewed and verified by Alfred Team ✅) 8 | 9 | If you have Alfred 5 or above, you can install and resolve dependencies with one click and enjoy in-app updates in the future. 10 | 11 | ➡️ [Go to official Alfred Gallery page](https://alfred.app/workflows/zqzten/web-search-suggest/) 12 | 13 | If you are still using Alfred 4 or older, you can [download from GitHub releases](https://github.com/zqzten/alfred-web-search-suggest/releases) and install it (just open with Alfred) manually. 14 | 15 | ## Important Note for macOS Monterey (12.0) and above 16 | 17 | Apple has removed the system PHP since macOS Monterey (12.0), so you should install PHP to continue using this workflow. 18 | 19 | If you have Alfred 5 or above, you can [let Alfred resolve dependencies automatically](https://www.alfredapp.com/help/kb/dependencies/). 20 | 21 | Or you can use [Homebrew](https://brew.sh/) to install PHP manually. After installing Homebrew, you can run the following command in Terminal to install PHP: 22 | ```shell 23 | brew install php 24 | ``` 25 | 26 | ## Supported Websites 27 | 28 | * [Google](#google) 29 | * [Wikipedia](#wikipedia) 30 | * [Wolfram|Alpha](#wolframalpha) 31 | * [Amazon](#amazon) 32 | * [IMDB](#imdb) 33 | * [DuckDuckGo](#duckduckgo) 34 | * [Brave Search](#brave-search) 35 | * [Pixiv](#pixiv) 36 | * [Baidu (百度)](#baidu) 37 | * [Zhihu (知乎)](#zhihu) 38 | * [bilibili (哔哩哔哩)](#bilibili) 39 | * ~~[Sina Weibo (新浪微博)](#sina-weibo)~~ 40 | * [Taobao (淘宝)](#taobao) 41 | * [JoyBuy (京东)](#joybuy) 42 | * [Bangumi (番组计划)](#bangumi) 43 | * [Moegirlpedia (萌娘百科)](#moegirlpedia) 44 | 45 | ## Details 46 | 47 | ### Google 48 | 49 | Support basic suggestions. [Proxy setting](#proxy-setting) is available. 50 | 51 | ![google](screenshots/google.png) 52 | 53 | ### Wikipedia 54 | 55 | Support direct term suggestions and preview, **language MUST be specified with [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) code in the first arg**. [Proxy setting](#proxy-setting) is available. 56 | 57 | ![wikipedia-en](screenshots/wikipedia-en.png) 58 | 59 | ![wikipedia-zh](screenshots/wikipedia-zh.png) 60 | 61 | ### Wolfram|Alpha 62 | 63 | Support direct term suggestions. [Proxy setting](#proxy-setting) is available. 64 | 65 | ![wolframalpha](screenshots/wolframalpha.png) 66 | 67 | ### Amazon 68 | 69 | Support basic suggestions. [Proxy setting](#proxy-setting) is available. 70 | 71 | ![amazon](screenshots/amazon.png) 72 | 73 | ### IMDB 74 | 75 | Support direct term suggestions and preview. [Proxy setting](#proxy-setting) is available. 76 | 77 | ![imdb](screenshots/imdb.png) 78 | 79 | ### DuckDuckGo 80 | 81 | Support basic suggestions. [Proxy setting](#proxy-setting) is available. 82 | 83 | ![duckduckgo](screenshots/duckduckgo.png) 84 | 85 | ### Brave Search 86 | 87 | Support basic suggestions. [Proxy setting](#proxy-setting) is available. 88 | 89 | ![bravesearch](screenshots/bravesearch.png) 90 | 91 | ### Pixiv 92 | 93 | Support basic suggestions. [Proxy setting](#proxy-setting) is available. 94 | 95 | ![pixiv](screenshots/pixiv.png) 96 | 97 | ### Baidu 98 | 99 | Support basic suggestions. 100 | 101 | ![baidu](screenshots/baidu.png) 102 | 103 | ### Zhihu 104 | 105 | Support basic suggestions. 106 | 107 | ![zhihu](screenshots/zhihu.png) 108 | 109 | ### bilibili 110 | 111 | Support basic suggestions with personalization. 112 | 113 | 注:可以在 [User Configuration](https://www.alfredapp.com/help/workflows/user-configuration/)(如果你使用 Alfred 4 及以下版本,则是在 [Environment Variable](https://www.alfredapp.com/help/workflows/advanced/variables/#environment))中设置你的 bilibili UID 以获得个性化搜索建议。你可以在你的 bilibili 个人主页的个人资料栏找到该 UID。 114 | 115 | ![bilibili](screenshots/bilibili.png) 116 | 117 | ### ~~Sina Weibo~~ 118 | 119 | Removed due to login needed. 120 | 121 | ### Taobao 122 | 123 | Support basic suggestions. 124 | 125 | ![taobao](screenshots/taobao.png) 126 | 127 | ### JoyBuy 128 | 129 | Support basic suggestions. 130 | 131 | ![joybuy](screenshots/joybuy.png) 132 | 133 | ### Bangumi 134 | 135 | Support direct term suggestions and preview, type can be specified in the first arg. 136 | 137 | 注:共支持 6 种条目类型的搜索,分别为全部(all)、动画(anime)、书籍(book)、音乐(music)、游戏(game)、三次元(real);对于每一条搜索结果,副标题默认显示该条目的类型(如果当前搜索类型为全部)和中文名称(若有),按 **⌘** 可显示其简介(若有),按 **⌃** 可显示其排名与评分(若有)。 138 | 139 | ![bangumi-all](screenshots/bangumi-all.png) 140 | 141 | ![bangumi-anime](screenshots/bangumi-anime.png) 142 | 143 | ### Moegirlpedia 144 | 145 | Support direct term suggestions and preview. [Proxy setting](#proxy-setting) is available. 146 | 147 | ![moegirlpedia](screenshots/moegirlpedia.png) 148 | 149 | ## Additional Notes 150 | 151 | ### Direct Search 152 | 153 | If you want an alternative to search exactly what you typed, you can add custom web searches in `Features → Web Search` of Alfred Preferences, here's a list of the search URLs above: 154 | 155 | * Google: `built-in` 156 | * Wikipedia: `built-in` 157 | * Wolfram|Alpha: `built-in` 158 | * Amazon: `built-in` 159 | * IMDB: `built-in` 160 | * DuckDuckGo: `built-in` 161 | * Brave Search: `https://search.brave.com/search?q={query}` 162 | * Pixiv: `https://www.pixiv.net/search.php?word={query}` 163 | * Baidu: `https://www.baidu.com/s?wd={query}` 164 | * Zhihu: `https://www.zhihu.com/search?q={query}` 165 | * bilibili: `https://search.bilibili.com/all?keyword={query}` 166 | * Sina Weibo: `https://s.weibo.com/weibo?q={query}` 167 | * Taobao: `https://s.taobao.com/search?q={query}` 168 | * JoyBuy: `https://search.jd.com/Search?enc=utf-8&keyword={query}` 169 | * Bangumi: `http://bangumi.tv/subject_search/{query}` 170 | * Moegirlpedia: `https://zh.moegirl.org.cn/index.php?search={query}` 171 | 172 | ### Proxy Setting 173 | 174 | Proxy setting is avaliable as: 175 | 176 | * [User Configuration](https://www.alfredapp.com/help/workflows/user-configuration/) named `Proxy` (for Alfred 5+) 177 | * [Environment Variable](https://www.alfredapp.com/help/workflows/advanced/variables/#environment) named `proxy` (for Alfred 4 and older) 178 | 179 | for these websites: 180 | 181 | * Google 182 | * Wikipedia 183 | * Wolfram|Alpha 184 | * Amazon 185 | * IMDB 186 | * DuckDuckGo 187 | * Brave Search 188 | * Pixiv 189 | * Moegirlpedia 190 | 191 | Here's some example settings: 192 | 193 | * If you use an HTTP proxy at `127.0.0.1:1087` without credentials, set `proxy` to `http://127.0.0.1:1087` 194 | * If you use a SOCKS5 proxy at `127.0.0.1:1086` with username `user` and password `pass`, set `proxy` to `socks5://user:pass@127.0.0.1:1086` 195 | 196 | For more details, check the [libcurl doc](https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html). 197 | -------------------------------------------------------------------------------- /screenshots/amazon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/amazon.png -------------------------------------------------------------------------------- /screenshots/baidu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/baidu.png -------------------------------------------------------------------------------- /screenshots/bangumi-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/bangumi-all.png -------------------------------------------------------------------------------- /screenshots/bangumi-anime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/bangumi-anime.png -------------------------------------------------------------------------------- /screenshots/bilibili.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/bilibili.png -------------------------------------------------------------------------------- /screenshots/bravesearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/bravesearch.png -------------------------------------------------------------------------------- /screenshots/duckduckgo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/duckduckgo.png -------------------------------------------------------------------------------- /screenshots/google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/google.png -------------------------------------------------------------------------------- /screenshots/imdb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/imdb.png -------------------------------------------------------------------------------- /screenshots/joybuy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/joybuy.png -------------------------------------------------------------------------------- /screenshots/moegirlpedia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/moegirlpedia.png -------------------------------------------------------------------------------- /screenshots/pixiv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/pixiv.png -------------------------------------------------------------------------------- /screenshots/taobao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/taobao.png -------------------------------------------------------------------------------- /screenshots/wikipedia-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/wikipedia-en.png -------------------------------------------------------------------------------- /screenshots/wikipedia-zh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/wikipedia-zh.png -------------------------------------------------------------------------------- /screenshots/wolframalpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/wolframalpha.png -------------------------------------------------------------------------------- /screenshots/zhihu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/screenshots/zhihu.png -------------------------------------------------------------------------------- /src/09DA712F-72B1-49D8-ADC6-F11C4DDB9B8C.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/09DA712F-72B1-49D8-ADC6-F11C4DDB9B8C.png -------------------------------------------------------------------------------- /src/186480B7-9F2F-43AD-9994-A9B8E053ADE5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/186480B7-9F2F-43AD-9994-A9B8E053ADE5.png -------------------------------------------------------------------------------- /src/3444F1D5-FE79-4B5F-A37D-DAA45D7D02F0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/3444F1D5-FE79-4B5F-A37D-DAA45D7D02F0.png -------------------------------------------------------------------------------- /src/471DBE2A-EC46-474C-9309-B78272DF472E.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/471DBE2A-EC46-474C-9309-B78272DF472E.png -------------------------------------------------------------------------------- /src/63F60794-BB56-4415-9372-BAF974C3A7E1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/63F60794-BB56-4415-9372-BAF974C3A7E1.png -------------------------------------------------------------------------------- /src/66323B0D-F24D-4F0C-BCB2-42D2BFA92C0F.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/66323B0D-F24D-4F0C-BCB2-42D2BFA92C0F.png -------------------------------------------------------------------------------- /src/67D1CDF9-CA40-4D8E-B66C-E0FF18FCE3CE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/67D1CDF9-CA40-4D8E-B66C-E0FF18FCE3CE.png -------------------------------------------------------------------------------- /src/702E9582-5E02-4094-9889-0C4A575F7DAF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/702E9582-5E02-4094-9889-0C4A575F7DAF.png -------------------------------------------------------------------------------- /src/7999A242-8DB6-41F9-BAD7-78C3E4CC0C41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/7999A242-8DB6-41F9-BAD7-78C3E4CC0C41.png -------------------------------------------------------------------------------- /src/7C5A1AA4-8766-42A7-ADC5-6B91963B3CD9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/7C5A1AA4-8766-42A7-ADC5-6B91963B3CD9.png -------------------------------------------------------------------------------- /src/80FCED49-07AA-4C15-9B49-24A52B3AF5D6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/80FCED49-07AA-4C15-9B49-24A52B3AF5D6.png -------------------------------------------------------------------------------- /src/861BE674-55FF-4779-A44A-A02FF66440B0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/861BE674-55FF-4779-A44A-A02FF66440B0.png -------------------------------------------------------------------------------- /src/A66D4C48-6D6D-4531-AF51-8463E488EEB2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/A66D4C48-6D6D-4531-AF51-8463E488EEB2.png -------------------------------------------------------------------------------- /src/AE15F1F6-37B0-4A47-BEE1-975354A81227.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/AE15F1F6-37B0-4A47-BEE1-975354A81227.png -------------------------------------------------------------------------------- /src/B1C4E5F1-FE5D-4505-9AD6-3F12A4F4ACC8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/B1C4E5F1-FE5D-4505-9AD6-3F12A4F4ACC8.png -------------------------------------------------------------------------------- /src/amazon.php: -------------------------------------------------------------------------------- 1 | result() 17 | ->title($data) 18 | ->subtitle('Search Amazon for '.$data) 19 | ->arg($data) 20 | ->icon(ICON) 21 | ->autocomplete($data); 22 | } 23 | 24 | echo $wf->output(); 25 | -------------------------------------------------------------------------------- /src/baidu.php: -------------------------------------------------------------------------------- 1 | result() 18 | ->title($data) 19 | ->subtitle('百度一下 '.$data) 20 | ->arg($data) 21 | ->icon(ICON) 22 | ->autocomplete($data); 23 | } 24 | 25 | echo $wf->output(); 26 | -------------------------------------------------------------------------------- /src/bangumi.php: -------------------------------------------------------------------------------- 1 | 0, 23 | 'book' => 1, 24 | 'anime' => 2, 25 | 'music' => 3, 26 | 'game' => 4, 27 | 'real' => 6 28 | ); 29 | $typeId = $typeIdDict[$type]; 30 | 31 | $response = request('https://api.bgm.tv/search/subject/'.urlencode($query)."?responseGroup=large&type=$typeId"); 32 | $json = json_decode($response); 33 | $results = $json->list; 34 | 35 | $typeNameDict = array( 36 | 0 => '全部', 37 | 1 => '书籍', 38 | 2 => '动画', 39 | 3 => '音乐', 40 | 4 => '游戏', 41 | 6 => '三次元' 42 | ); 43 | 44 | if ($results) { 45 | foreach ($results as $sugg) { 46 | $name = html_entity_decode($sugg->name, ENT_QUOTES | ENT_HTML5); 47 | $nameCN = html_entity_decode($sugg->name_cn, ENT_QUOTES | ENT_HTML5); 48 | $url = $sugg->url; 49 | $icon = $sugg->images->small ?? ICON; 50 | $rank = $sugg->rank ?? 0; 51 | $score = $sugg->rating->score ?? 0; 52 | $wf->result() 53 | ->title($name) 54 | ->subtitle(($type === 'all' ? '【'.$typeNameDict[$sugg->type].'】' : '').$nameCN) 55 | ->arg($url) 56 | ->icon(saveAndReturnFile($icon)) 57 | ->autocomplete($name) 58 | ->cmd(str_replace("\r\n", '', html_entity_decode($sugg->summary, ENT_QUOTES | ENT_HTML5)), $url) 59 | ->ctrl(($rank === 0 ? '' : "Rank: $rank ").($score === 0 ? '' : "Score: $score"), $url) 60 | ->copy($name) 61 | ->quicklookurl($url); 62 | } 63 | } 64 | 65 | $wf->result() 66 | ->title("Search 番组计划 for '$query'") 67 | ->subtitle($typeNameDict[$typeId].'条目') 68 | ->arg('http://bgm.tv/subject_search/'.urlencode($query)."?cat=$typeId") 69 | ->icon(ICON) 70 | ->copy($query); 71 | } 72 | 73 | echo $wf->output(); 74 | -------------------------------------------------------------------------------- /src/bilibili.php: -------------------------------------------------------------------------------- 1 | result->tag; 15 | 16 | foreach ($results as $sugg) { 17 | $data = $sugg->value; 18 | $wf->result() 19 | ->title($data) 20 | ->subtitle('Search 哔哩哔哩 for '.$data) 21 | ->arg($data) 22 | ->icon(ICON) 23 | ->autocomplete($data); 24 | } 25 | 26 | echo $wf->output(); 27 | -------------------------------------------------------------------------------- /src/brave.php: -------------------------------------------------------------------------------- 1 | result() 18 | ->title($sugg) 19 | ->subtitle('Brave Search for '.$sugg) 20 | ->arg($sugg) 21 | ->icon(ICON) 22 | ->autocomplete($sugg); 23 | } 24 | 25 | echo $wf->output(); 26 | -------------------------------------------------------------------------------- /src/duckduckgo.php: -------------------------------------------------------------------------------- 1 | phrase; 17 | $wf->result() 18 | ->title($key) 19 | ->subtitle('DuckDuckGo for '.$key) 20 | ->arg($key) 21 | ->icon(ICON) 22 | ->autocomplete($key); 23 | } 24 | 25 | echo $wf->output(); 26 | -------------------------------------------------------------------------------- /src/google.php: -------------------------------------------------------------------------------- 1 | suggestion->attributes()->data; 17 | $wf->result() 18 | ->title($data) 19 | ->subtitle('Search Google for '.$data) 20 | ->arg($data) 21 | ->icon(ICON) 22 | ->autocomplete($data); 23 | } 24 | 25 | echo $wf->output(); 26 | -------------------------------------------------------------------------------- /src/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zqzten/alfred-web-search-suggest/33d38ed09ff98d506855b322ce5ce64a84d9b7d1/src/icon.png -------------------------------------------------------------------------------- /src/imdb.php: -------------------------------------------------------------------------------- 1 | d; 19 | 20 | if (is_array($data)) { 21 | foreach ($data as $sugg) { 22 | $title = $sugg->l; 23 | $subtitle = $sugg->s; 24 | $icon = saveAndReturnFile(str_replace('_V1_', '_V1_UY100', $sugg->i->imageUrl)); // try to fetch a small sized icon 25 | $subpath = $sugg->id; 26 | $prefix = substr($subpath, 0, 2); 27 | switch ($prefix) { 28 | case 'tt': 29 | $subpath = '/title/'.$subpath; 30 | break; 31 | case 'nm': 32 | $subpath = '/name/'.$subpath; 33 | break; 34 | default: 35 | break; 36 | } 37 | $arg = 'https://www.imdb.com'.$subpath; 38 | 39 | $wf->result() 40 | ->title($title) 41 | ->subtitle($subtitle) 42 | ->arg($arg) 43 | ->icon($icon) 44 | ->autocomplete($title) 45 | ->copy($title) 46 | ->quicklookurl($arg); 47 | } 48 | } 49 | 50 | echo $wf->output(); -------------------------------------------------------------------------------- /src/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.akikoz.alfred.websearchsuggest 7 | category 8 | Search 9 | connections 10 | 11 | 09DA712F-72B1-49D8-ADC6-F11C4DDB9B8C 12 | 13 | 14 | destinationuid 15 | 0AD9B8D9-A796-472A-855F-D6199DFFB1DF 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | vitoclose 21 | 22 | 23 | 24 | 186480B7-9F2F-43AD-9994-A9B8E053ADE5 25 | 26 | 27 | destinationuid 28 | 89D407F2-9C8D-403B-9503-AE755F3474B2 29 | modifiers 30 | 0 31 | modifiersubtext 32 | 33 | vitoclose 34 | 35 | 36 | 37 | 3444F1D5-FE79-4B5F-A37D-DAA45D7D02F0 38 | 39 | 40 | destinationuid 41 | D3798DBA-B371-47CF-8AB5-E3837B8F876E 42 | modifiers 43 | 0 44 | modifiersubtext 45 | 46 | vitoclose 47 | 48 | 49 | 50 | 471DBE2A-EC46-474C-9309-B78272DF472E 51 | 52 | 53 | destinationuid 54 | 743DEE1F-2F8A-4976-BB38-487D51340149 55 | modifiers 56 | 0 57 | modifiersubtext 58 | 59 | vitoclose 60 | 61 | 62 | 63 | 63F60794-BB56-4415-9372-BAF974C3A7E1 64 | 65 | 66 | destinationuid 67 | B8FFA3AB-AD7D-4316-A84F-5958A671D4FF 68 | modifiers 69 | 0 70 | modifiersubtext 71 | 72 | vitoclose 73 | 74 | 75 | 76 | 66323B0D-F24D-4F0C-BCB2-42D2BFA92C0F 77 | 78 | 79 | destinationuid 80 | 71D9DDA7-98FB-48B8-9D0C-0B8C17ED7E22 81 | modifiers 82 | 0 83 | modifiersubtext 84 | 85 | vitoclose 86 | 87 | 88 | 89 | 67D1CDF9-CA40-4D8E-B66C-E0FF18FCE3CE 90 | 91 | 92 | destinationuid 93 | CEEB69A1-B6D7-429F-BEF0-636600076441 94 | modifiers 95 | 0 96 | modifiersubtext 97 | 98 | vitoclose 99 | 100 | 101 | 102 | 702E9582-5E02-4094-9889-0C4A575F7DAF 103 | 104 | 105 | destinationuid 106 | 0528CC1E-2E67-43AF-9016-1B7A76A1CF96 107 | modifiers 108 | 0 109 | modifiersubtext 110 | 111 | vitoclose 112 | 113 | 114 | 115 | 7999A242-8DB6-41F9-BAD7-78C3E4CC0C41 116 | 117 | 118 | destinationuid 119 | DDC3EC54-50D5-429B-BFE0-3C06F14766AE 120 | modifiers 121 | 0 122 | modifiersubtext 123 | 124 | vitoclose 125 | 126 | 127 | 128 | 7C5A1AA4-8766-42A7-ADC5-6B91963B3CD9 129 | 130 | 131 | destinationuid 132 | A8AA5019-512C-4773-83FC-35FEA14DD158 133 | modifiers 134 | 0 135 | modifiersubtext 136 | 137 | vitoclose 138 | 139 | 140 | 141 | 80FCED49-07AA-4C15-9B49-24A52B3AF5D6 142 | 143 | 144 | destinationuid 145 | 5125D249-AC10-405F-9EE5-63362700B29F 146 | modifiers 147 | 0 148 | modifiersubtext 149 | 150 | vitoclose 151 | 152 | 153 | 154 | 861BE674-55FF-4779-A44A-A02FF66440B0 155 | 156 | 157 | destinationuid 158 | D5E649CF-505D-458A-913B-ABE9A226E9FA 159 | modifiers 160 | 0 161 | modifiersubtext 162 | 163 | vitoclose 164 | 165 | 166 | 167 | A66D4C48-6D6D-4531-AF51-8463E488EEB2 168 | 169 | 170 | destinationuid 171 | 004C4A20-A68E-4502-A7E0-990BD7FF2B46 172 | modifiers 173 | 0 174 | modifiersubtext 175 | 176 | vitoclose 177 | 178 | 179 | 180 | AE15F1F6-37B0-4A47-BEE1-975354A81227 181 | 182 | 183 | destinationuid 184 | A10DF307-B927-4060-A800-9B2A6EC4CA52 185 | modifiers 186 | 0 187 | modifiersubtext 188 | 189 | vitoclose 190 | 191 | 192 | 193 | B1C4E5F1-FE5D-4505-9AD6-3F12A4F4ACC8 194 | 195 | 196 | destinationuid 197 | A76FF79E-3778-4855-93AA-20969F1A152A 198 | modifiers 199 | 0 200 | modifiersubtext 201 | 202 | vitoclose 203 | 204 | 205 | 206 | 207 | createdby 208 | Zach Zhu 209 | description 210 | Get in-line web search suggestions 211 | disabled 212 | 213 | name 214 | Web Search Suggest 215 | objects 216 | 217 | 218 | config 219 | 220 | alfredfiltersresults 221 | 222 | alfredfiltersresultsmatchmode 223 | 0 224 | argumenttreatemptyqueryasnil 225 | 226 | argumenttrimmode 227 | 0 228 | argumenttype 229 | 0 230 | escaping 231 | 36 232 | keyword 233 | gg 234 | queuedelaycustom 235 | 3 236 | queuedelayimmediatelyinitially 237 | 238 | queuedelaymode 239 | 1 240 | queuemode 241 | 2 242 | runningsubtext 243 | Retrieving search suggestions ... 244 | script 245 | $query = "{query}"; 246 | $opt[CURLOPT_PROXY] = getenv('proxy'); 247 | 248 | require_once('google.php'); 249 | scriptargtype 250 | 0 251 | scriptfile 252 | 253 | subtext 254 | Search Google with Suggestions 255 | title 256 | Search Google 257 | type 258 | 1 259 | withspace 260 | 261 | 262 | type 263 | alfred.workflow.input.scriptfilter 264 | uid 265 | 63F60794-BB56-4415-9372-BAF974C3A7E1 266 | version 267 | 3 268 | 269 | 270 | config 271 | 272 | browser 273 | 274 | searcher 275 | 1635215215 276 | 277 | type 278 | alfred.workflow.action.systemwebsearch 279 | uid 280 | B8FFA3AB-AD7D-4316-A84F-5958A671D4FF 281 | version 282 | 1 283 | 284 | 285 | config 286 | 287 | browser 288 | 289 | skipqueryencode 290 | 291 | skipvarencode 292 | 293 | spaces 294 | 295 | url 296 | {query} 297 | 298 | type 299 | alfred.workflow.action.openurl 300 | uid 301 | 5125D249-AC10-405F-9EE5-63362700B29F 302 | version 303 | 1 304 | 305 | 306 | config 307 | 308 | alfredfiltersresults 309 | 310 | alfredfiltersresultsmatchmode 311 | 0 312 | argumenttreatemptyqueryasnil 313 | 314 | argumenttrimmode 315 | 0 316 | argumenttype 317 | 0 318 | escaping 319 | 36 320 | keyword 321 | wiki 322 | queuedelaycustom 323 | 3 324 | queuedelayimmediatelyinitially 325 | 326 | queuedelaymode 327 | 1 328 | queuemode 329 | 2 330 | runningsubtext 331 | Retrieving search suggestions ... 332 | script 333 | $query = "{query}"; 334 | $opt[CURLOPT_PROXY] = getenv('proxy'); 335 | 336 | require_once('wikipedia.php'); 337 | scriptargtype 338 | 0 339 | scriptfile 340 | 341 | subtext 342 | Search Wikipedia with Suggestions 343 | title 344 | Search Wikipedia 345 | type 346 | 1 347 | withspace 348 | 349 | 350 | type 351 | alfred.workflow.input.scriptfilter 352 | uid 353 | 80FCED49-07AA-4C15-9B49-24A52B3AF5D6 354 | version 355 | 3 356 | 357 | 358 | config 359 | 360 | alfredfiltersresults 361 | 362 | alfredfiltersresultsmatchmode 363 | 0 364 | argumenttreatemptyqueryasnil 365 | 366 | argumenttrimmode 367 | 0 368 | argumenttype 369 | 0 370 | escaping 371 | 36 372 | keyword 373 | wa 374 | queuedelaycustom 375 | 3 376 | queuedelayimmediatelyinitially 377 | 378 | queuedelaymode 379 | 1 380 | queuemode 381 | 2 382 | runningsubtext 383 | Retrieving asking suggestions ... 384 | script 385 | $query = "{query}"; 386 | $opt[CURLOPT_PROXY] = getenv('proxy'); 387 | 388 | require_once('wolframalpha.php'); 389 | scriptargtype 390 | 0 391 | scriptfile 392 | 393 | subtext 394 | Ask Wolfram|Alpha with Suggestions 395 | title 396 | Ask Wolfram|Alpha 397 | type 398 | 1 399 | withspace 400 | 401 | 402 | type 403 | alfred.workflow.input.scriptfilter 404 | uid 405 | 67D1CDF9-CA40-4D8E-B66C-E0FF18FCE3CE 406 | version 407 | 3 408 | 409 | 410 | config 411 | 412 | browser 413 | 414 | searcher 415 | 1635219297 416 | 417 | type 418 | alfred.workflow.action.systemwebsearch 419 | uid 420 | CEEB69A1-B6D7-429F-BEF0-636600076441 421 | version 422 | 1 423 | 424 | 425 | config 426 | 427 | alfredfiltersresults 428 | 429 | alfredfiltersresultsmatchmode 430 | 0 431 | argumenttreatemptyqueryasnil 432 | 433 | argumenttrimmode 434 | 0 435 | argumenttype 436 | 0 437 | escaping 438 | 36 439 | keyword 440 | ama 441 | queuedelaycustom 442 | 3 443 | queuedelayimmediatelyinitially 444 | 445 | queuedelaymode 446 | 1 447 | queuemode 448 | 2 449 | runningsubtext 450 | Retrieving search suggestions ... 451 | script 452 | $query = "{query}"; 453 | $opt[CURLOPT_PROXY] = getenv('proxy'); 454 | 455 | require_once('amazon.php'); 456 | scriptargtype 457 | 0 458 | scriptfile 459 | 460 | subtext 461 | Search Amazon with Suggestions 462 | title 463 | Search Amazon 464 | type 465 | 1 466 | withspace 467 | 468 | 469 | type 470 | alfred.workflow.input.scriptfilter 471 | uid 472 | 3444F1D5-FE79-4B5F-A37D-DAA45D7D02F0 473 | version 474 | 3 475 | 476 | 477 | config 478 | 479 | browser 480 | 481 | searcher 482 | 1635213677 483 | 484 | type 485 | alfred.workflow.action.systemwebsearch 486 | uid 487 | D3798DBA-B371-47CF-8AB5-E3837B8F876E 488 | version 489 | 1 490 | 491 | 492 | config 493 | 494 | browser 495 | 496 | skipqueryencode 497 | 498 | skipvarencode 499 | 500 | spaces 501 | 502 | url 503 | {query} 504 | 505 | type 506 | alfred.workflow.action.openurl 507 | uid 508 | 71D9DDA7-98FB-48B8-9D0C-0B8C17ED7E22 509 | version 510 | 1 511 | 512 | 513 | config 514 | 515 | alfredfiltersresults 516 | 517 | alfredfiltersresultsmatchmode 518 | 0 519 | argumenttreatemptyqueryasnil 520 | 521 | argumenttrimmode 522 | 0 523 | argumenttype 524 | 0 525 | escaping 526 | 36 527 | keyword 528 | imdb 529 | queuedelaycustom 530 | 3 531 | queuedelayimmediatelyinitially 532 | 533 | queuedelaymode 534 | 1 535 | queuemode 536 | 2 537 | runningsubtext 538 | Retrieving search suggestions ... 539 | script 540 | $query = "{query}"; 541 | $opt[CURLOPT_PROXY] = getenv('proxy'); 542 | 543 | require_once('imdb.php'); 544 | scriptargtype 545 | 0 546 | scriptfile 547 | 548 | subtext 549 | Search IMDB with Suggestions 550 | title 551 | Search IMDB 552 | type 553 | 1 554 | withspace 555 | 556 | 557 | type 558 | alfred.workflow.input.scriptfilter 559 | uid 560 | 66323B0D-F24D-4F0C-BCB2-42D2BFA92C0F 561 | version 562 | 3 563 | 564 | 565 | config 566 | 567 | alfredfiltersresults 568 | 569 | alfredfiltersresultsmatchmode 570 | 0 571 | argumenttreatemptyqueryasnil 572 | 573 | argumenttrimmode 574 | 0 575 | argumenttype 576 | 0 577 | escaping 578 | 36 579 | keyword 580 | duck 581 | queuedelaycustom 582 | 3 583 | queuedelayimmediatelyinitially 584 | 585 | queuedelaymode 586 | 1 587 | queuemode 588 | 2 589 | runningsubtext 590 | Retrieving search suggestions ... 591 | script 592 | $query = "{query}"; 593 | $opt[CURLOPT_PROXY] = getenv('proxy'); 594 | 595 | require_once('duckduckgo.php'); 596 | scriptargtype 597 | 0 598 | scriptfile 599 | 600 | subtext 601 | DuckDuckGo with Suggestions 602 | title 603 | DuckDuckGo 604 | type 605 | 1 606 | withspace 607 | 608 | 609 | type 610 | alfred.workflow.input.scriptfilter 611 | uid 612 | 471DBE2A-EC46-474C-9309-B78272DF472E 613 | version 614 | 3 615 | 616 | 617 | config 618 | 619 | browser 620 | 621 | searcher 622 | 1635214453 623 | 624 | type 625 | alfred.workflow.action.systemwebsearch 626 | uid 627 | 743DEE1F-2F8A-4976-BB38-487D51340149 628 | version 629 | 1 630 | 631 | 632 | config 633 | 634 | browser 635 | 636 | skipqueryencode 637 | 638 | skipvarencode 639 | 640 | spaces 641 | 642 | url 643 | https://search.brave.com/search?q={query} 644 | 645 | type 646 | alfred.workflow.action.openurl 647 | uid 648 | 0AD9B8D9-A796-472A-855F-D6199DFFB1DF 649 | version 650 | 1 651 | 652 | 653 | config 654 | 655 | alfredfiltersresults 656 | 657 | alfredfiltersresultsmatchmode 658 | 0 659 | argumenttreatemptyqueryasnil 660 | 661 | argumenttrimmode 662 | 0 663 | argumenttype 664 | 0 665 | escaping 666 | 36 667 | keyword 668 | brave 669 | queuedelaycustom 670 | 3 671 | queuedelayimmediatelyinitially 672 | 673 | queuedelaymode 674 | 1 675 | queuemode 676 | 2 677 | runningsubtext 678 | Retrieving search suggestions ... 679 | script 680 | $query = "{query}"; 681 | $opt[CURLOPT_PROXY] = getenv('proxy'); 682 | 683 | require_once('brave.php'); 684 | scriptargtype 685 | 0 686 | scriptfile 687 | 688 | subtext 689 | Brave Search with Suggestions 690 | title 691 | Brave Search 692 | type 693 | 1 694 | withspace 695 | 696 | 697 | type 698 | alfred.workflow.input.scriptfilter 699 | uid 700 | 09DA712F-72B1-49D8-ADC6-F11C4DDB9B8C 701 | version 702 | 3 703 | 704 | 705 | config 706 | 707 | browser 708 | 709 | skipqueryencode 710 | 711 | skipvarencode 712 | 713 | spaces 714 | 715 | url 716 | https://www.pixiv.net/search.php?word={query} 717 | 718 | type 719 | alfred.workflow.action.openurl 720 | uid 721 | 004C4A20-A68E-4502-A7E0-990BD7FF2B46 722 | version 723 | 1 724 | 725 | 726 | config 727 | 728 | alfredfiltersresults 729 | 730 | alfredfiltersresultsmatchmode 731 | 0 732 | argumenttreatemptyqueryasnil 733 | 734 | argumenttrimmode 735 | 0 736 | argumenttype 737 | 0 738 | escaping 739 | 36 740 | keyword 741 | px 742 | queuedelaycustom 743 | 3 744 | queuedelayimmediatelyinitially 745 | 746 | queuedelaymode 747 | 1 748 | queuemode 749 | 2 750 | runningsubtext 751 | Retrieving search suggestions ... 752 | script 753 | $query = "{query}"; 754 | $opt[CURLOPT_PROXY] = getenv('proxy'); 755 | 756 | require_once('pixiv.php'); 757 | scriptargtype 758 | 0 759 | scriptfile 760 | 761 | subtext 762 | Search Pixiv with Suggestions 763 | title 764 | Search Pixiv 765 | type 766 | 1 767 | withspace 768 | 769 | 770 | type 771 | alfred.workflow.input.scriptfilter 772 | uid 773 | A66D4C48-6D6D-4531-AF51-8463E488EEB2 774 | version 775 | 3 776 | 777 | 778 | config 779 | 780 | alfredfiltersresults 781 | 782 | alfredfiltersresultsmatchmode 783 | 0 784 | argumenttreatemptyqueryasnil 785 | 786 | argumenttrimmode 787 | 0 788 | argumenttype 789 | 0 790 | escaping 791 | 36 792 | keyword 793 | bd 794 | queuedelaycustom 795 | 3 796 | queuedelayimmediatelyinitially 797 | 798 | queuedelaymode 799 | 1 800 | queuemode 801 | 2 802 | runningsubtext 803 | Retrieving search suggestions ... 804 | script 805 | $query = "{query}"; 806 | 807 | require_once('baidu.php'); 808 | scriptargtype 809 | 0 810 | scriptfile 811 | 812 | subtext 813 | 百度一下 with Suggestions 814 | title 815 | 百度一下 816 | type 817 | 1 818 | withspace 819 | 820 | 821 | type 822 | alfred.workflow.input.scriptfilter 823 | uid 824 | 702E9582-5E02-4094-9889-0C4A575F7DAF 825 | version 826 | 3 827 | 828 | 829 | config 830 | 831 | browser 832 | 833 | skipqueryencode 834 | 835 | skipvarencode 836 | 837 | spaces 838 | 839 | url 840 | https://www.baidu.com/s?wd={query} 841 | 842 | type 843 | alfred.workflow.action.openurl 844 | uid 845 | 0528CC1E-2E67-43AF-9016-1B7A76A1CF96 846 | version 847 | 1 848 | 849 | 850 | config 851 | 852 | browser 853 | 854 | skipqueryencode 855 | 856 | skipvarencode 857 | 858 | spaces 859 | 860 | url 861 | https://www.zhihu.com/search?q={query} 862 | 863 | type 864 | alfred.workflow.action.openurl 865 | uid 866 | D5E649CF-505D-458A-913B-ABE9A226E9FA 867 | version 868 | 1 869 | 870 | 871 | config 872 | 873 | alfredfiltersresults 874 | 875 | alfredfiltersresultsmatchmode 876 | 0 877 | argumenttreatemptyqueryasnil 878 | 879 | argumenttrimmode 880 | 0 881 | argumenttype 882 | 0 883 | escaping 884 | 36 885 | keyword 886 | zh 887 | queuedelaycustom 888 | 3 889 | queuedelayimmediatelyinitially 890 | 891 | queuedelaymode 892 | 1 893 | queuemode 894 | 2 895 | runningsubtext 896 | Retrieving search suggestions ... 897 | script 898 | $query = "{query}"; 899 | 900 | require_once('zhihu.php'); 901 | scriptargtype 902 | 0 903 | scriptfile 904 | 905 | subtext 906 | Search 知乎 with Suggestions 907 | title 908 | Search 知乎 909 | type 910 | 1 911 | withspace 912 | 913 | 914 | type 915 | alfred.workflow.input.scriptfilter 916 | uid 917 | 861BE674-55FF-4779-A44A-A02FF66440B0 918 | version 919 | 3 920 | 921 | 922 | config 923 | 924 | alfredfiltersresults 925 | 926 | alfredfiltersresultsmatchmode 927 | 0 928 | argumenttreatemptyqueryasnil 929 | 930 | argumenttrimmode 931 | 0 932 | argumenttype 933 | 0 934 | escaping 935 | 36 936 | keyword 937 | bl 938 | queuedelaycustom 939 | 3 940 | queuedelayimmediatelyinitially 941 | 942 | queuedelaymode 943 | 1 944 | queuemode 945 | 2 946 | runningsubtext 947 | Retrieving search suggestions ... 948 | script 949 | $query = "{query}"; 950 | 951 | require_once('bilibili.php'); 952 | scriptargtype 953 | 0 954 | scriptfile 955 | 956 | subtext 957 | Search 哔哩哔哩 with Suggestions 958 | title 959 | Search 哔哩哔哩 960 | type 961 | 1 962 | withspace 963 | 964 | 965 | type 966 | alfred.workflow.input.scriptfilter 967 | uid 968 | AE15F1F6-37B0-4A47-BEE1-975354A81227 969 | version 970 | 3 971 | 972 | 973 | config 974 | 975 | browser 976 | 977 | skipqueryencode 978 | 979 | skipvarencode 980 | 981 | spaces 982 | 983 | url 984 | https://search.bilibili.com/all?keyword={query} 985 | 986 | type 987 | alfred.workflow.action.openurl 988 | uid 989 | A10DF307-B927-4060-A800-9B2A6EC4CA52 990 | version 991 | 1 992 | 993 | 994 | config 995 | 996 | browser 997 | 998 | skipqueryencode 999 | 1000 | skipvarencode 1001 | 1002 | spaces 1003 | 1004 | url 1005 | https://s.taobao.com/search?q={query} 1006 | 1007 | type 1008 | alfred.workflow.action.openurl 1009 | uid 1010 | 89D407F2-9C8D-403B-9503-AE755F3474B2 1011 | version 1012 | 1 1013 | 1014 | 1015 | config 1016 | 1017 | alfredfiltersresults 1018 | 1019 | alfredfiltersresultsmatchmode 1020 | 0 1021 | argumenttreatemptyqueryasnil 1022 | 1023 | argumenttrimmode 1024 | 0 1025 | argumenttype 1026 | 0 1027 | escaping 1028 | 36 1029 | keyword 1030 | tb 1031 | queuedelaycustom 1032 | 3 1033 | queuedelayimmediatelyinitially 1034 | 1035 | queuedelaymode 1036 | 1 1037 | queuemode 1038 | 2 1039 | runningsubtext 1040 | Retrieving search suggestions ... 1041 | script 1042 | $query = "{query}"; 1043 | 1044 | require_once('taobao.php'); 1045 | scriptargtype 1046 | 0 1047 | scriptfile 1048 | 1049 | subtext 1050 | Search 淘宝 with Suggestions 1051 | title 1052 | Search 淘宝 1053 | type 1054 | 1 1055 | withspace 1056 | 1057 | 1058 | type 1059 | alfred.workflow.input.scriptfilter 1060 | uid 1061 | 186480B7-9F2F-43AD-9994-A9B8E053ADE5 1062 | version 1063 | 3 1064 | 1065 | 1066 | config 1067 | 1068 | browser 1069 | 1070 | skipqueryencode 1071 | 1072 | skipvarencode 1073 | 1074 | spaces 1075 | 1076 | url 1077 | https://search.jd.com/Search?enc=utf-8&keyword={query} 1078 | 1079 | type 1080 | alfred.workflow.action.openurl 1081 | uid 1082 | A76FF79E-3778-4855-93AA-20969F1A152A 1083 | version 1084 | 1 1085 | 1086 | 1087 | config 1088 | 1089 | alfredfiltersresults 1090 | 1091 | alfredfiltersresultsmatchmode 1092 | 0 1093 | argumenttreatemptyqueryasnil 1094 | 1095 | argumenttrimmode 1096 | 0 1097 | argumenttype 1098 | 0 1099 | escaping 1100 | 36 1101 | keyword 1102 | jd 1103 | queuedelaycustom 1104 | 3 1105 | queuedelayimmediatelyinitially 1106 | 1107 | queuedelaymode 1108 | 1 1109 | queuemode 1110 | 2 1111 | runningsubtext 1112 | Retrieving search suggestions ... 1113 | script 1114 | $query = "{query}"; 1115 | 1116 | require_once('joybuy.php'); 1117 | scriptargtype 1118 | 0 1119 | scriptfile 1120 | 1121 | subtext 1122 | Search 京东 with Suggestions 1123 | title 1124 | Search 京东 1125 | type 1126 | 1 1127 | withspace 1128 | 1129 | 1130 | type 1131 | alfred.workflow.input.scriptfilter 1132 | uid 1133 | B1C4E5F1-FE5D-4505-9AD6-3F12A4F4ACC8 1134 | version 1135 | 3 1136 | 1137 | 1138 | config 1139 | 1140 | browser 1141 | 1142 | skipqueryencode 1143 | 1144 | skipvarencode 1145 | 1146 | spaces 1147 | 1148 | url 1149 | {query} 1150 | 1151 | type 1152 | alfred.workflow.action.openurl 1153 | uid 1154 | A8AA5019-512C-4773-83FC-35FEA14DD158 1155 | version 1156 | 1 1157 | 1158 | 1159 | config 1160 | 1161 | alfredfiltersresults 1162 | 1163 | alfredfiltersresultsmatchmode 1164 | 0 1165 | argumenttreatemptyqueryasnil 1166 | 1167 | argumenttrimmode 1168 | 0 1169 | argumenttype 1170 | 0 1171 | escaping 1172 | 36 1173 | keyword 1174 | bgm 1175 | queuedelaycustom 1176 | 3 1177 | queuedelayimmediatelyinitially 1178 | 1179 | queuedelaymode 1180 | 1 1181 | queuemode 1182 | 2 1183 | runningsubtext 1184 | Retrieving search suggestions ... 1185 | script 1186 | $query = "{query}"; 1187 | 1188 | require_once('bangumi.php'); 1189 | scriptargtype 1190 | 0 1191 | scriptfile 1192 | 1193 | subtext 1194 | Search 番组计划 with Suggestions 1195 | title 1196 | Search 番组计划 1197 | type 1198 | 1 1199 | withspace 1200 | 1201 | 1202 | type 1203 | alfred.workflow.input.scriptfilter 1204 | uid 1205 | 7C5A1AA4-8766-42A7-ADC5-6B91963B3CD9 1206 | version 1207 | 3 1208 | 1209 | 1210 | config 1211 | 1212 | browser 1213 | 1214 | skipqueryencode 1215 | 1216 | skipvarencode 1217 | 1218 | spaces 1219 | 1220 | url 1221 | {query} 1222 | 1223 | type 1224 | alfred.workflow.action.openurl 1225 | uid 1226 | DDC3EC54-50D5-429B-BFE0-3C06F14766AE 1227 | version 1228 | 1 1229 | 1230 | 1231 | config 1232 | 1233 | alfredfiltersresults 1234 | 1235 | alfredfiltersresultsmatchmode 1236 | 0 1237 | argumenttreatemptyqueryasnil 1238 | 1239 | argumenttrimmode 1240 | 0 1241 | argumenttype 1242 | 0 1243 | escaping 1244 | 36 1245 | keyword 1246 | moe 1247 | queuedelaycustom 1248 | 3 1249 | queuedelayimmediatelyinitially 1250 | 1251 | queuedelaymode 1252 | 1 1253 | queuemode 1254 | 2 1255 | runningsubtext 1256 | Retrieving search suggestions ... 1257 | script 1258 | $query = "{query}"; 1259 | $opt[CURLOPT_PROXY] = getenv('proxy'); 1260 | 1261 | require_once('moegirlpedia.php'); 1262 | scriptargtype 1263 | 0 1264 | scriptfile 1265 | 1266 | subtext 1267 | Search 萌娘百科 with Suggestions 1268 | title 1269 | Search 萌娘百科 1270 | type 1271 | 1 1272 | withspace 1273 | 1274 | 1275 | type 1276 | alfred.workflow.input.scriptfilter 1277 | uid 1278 | 7999A242-8DB6-41F9-BAD7-78C3E4CC0C41 1279 | version 1280 | 3 1281 | 1282 | 1283 | readme 1284 | # Alfred Web Search Suggest 1285 | 1286 | Alfred search suggest workflow for various popular websites. Inspired by the official Google Suggest workflow. 1287 | 1288 | For detailed introductions and screenshots / reporting a bug / making contributions, refer to the project's [GitHub page](https://github.com/zqzten/alfred-web-search-suggest). 1289 | uidata 1290 | 1291 | 004C4A20-A68E-4502-A7E0-990BD7FF2B46 1292 | 1293 | xpos 1294 | 270 1295 | ypos 1296 | 1005 1297 | 1298 | 0528CC1E-2E67-43AF-9016-1B7A76A1CF96 1299 | 1300 | xpos 1301 | 270 1302 | ypos 1303 | 1150 1304 | 1305 | 09DA712F-72B1-49D8-ADC6-F11C4DDB9B8C 1306 | 1307 | xpos 1308 | 50 1309 | ypos 1310 | 865 1311 | 1312 | 0AD9B8D9-A796-472A-855F-D6199DFFB1DF 1313 | 1314 | xpos 1315 | 270 1316 | ypos 1317 | 865 1318 | 1319 | 186480B7-9F2F-43AD-9994-A9B8E053ADE5 1320 | 1321 | xpos 1322 | 50 1323 | ypos 1324 | 1570 1325 | 1326 | 3444F1D5-FE79-4B5F-A37D-DAA45D7D02F0 1327 | 1328 | xpos 1329 | 50 1330 | ypos 1331 | 450 1332 | 1333 | 471DBE2A-EC46-474C-9309-B78272DF472E 1334 | 1335 | xpos 1336 | 50 1337 | ypos 1338 | 725 1339 | 1340 | 5125D249-AC10-405F-9EE5-63362700B29F 1341 | 1342 | xpos 1343 | 270 1344 | ypos 1345 | 170 1346 | 1347 | 63F60794-BB56-4415-9372-BAF974C3A7E1 1348 | 1349 | xpos 1350 | 50 1351 | ypos 1352 | 30 1353 | 1354 | 66323B0D-F24D-4F0C-BCB2-42D2BFA92C0F 1355 | 1356 | xpos 1357 | 50 1358 | ypos 1359 | 590 1360 | 1361 | 67D1CDF9-CA40-4D8E-B66C-E0FF18FCE3CE 1362 | 1363 | xpos 1364 | 50 1365 | ypos 1366 | 310 1367 | 1368 | 702E9582-5E02-4094-9889-0C4A575F7DAF 1369 | 1370 | xpos 1371 | 50 1372 | ypos 1373 | 1150 1374 | 1375 | 71D9DDA7-98FB-48B8-9D0C-0B8C17ED7E22 1376 | 1377 | xpos 1378 | 270 1379 | ypos 1380 | 590 1381 | 1382 | 743DEE1F-2F8A-4976-BB38-487D51340149 1383 | 1384 | xpos 1385 | 270 1386 | ypos 1387 | 725 1388 | 1389 | 7999A242-8DB6-41F9-BAD7-78C3E4CC0C41 1390 | 1391 | xpos 1392 | 50 1393 | ypos 1394 | 1990 1395 | 1396 | 7C5A1AA4-8766-42A7-ADC5-6B91963B3CD9 1397 | 1398 | xpos 1399 | 50 1400 | ypos 1401 | 1850 1402 | 1403 | 80FCED49-07AA-4C15-9B49-24A52B3AF5D6 1404 | 1405 | xpos 1406 | 50 1407 | ypos 1408 | 170 1409 | 1410 | 861BE674-55FF-4779-A44A-A02FF66440B0 1411 | 1412 | xpos 1413 | 50 1414 | ypos 1415 | 1290 1416 | 1417 | 89D407F2-9C8D-403B-9503-AE755F3474B2 1418 | 1419 | xpos 1420 | 270 1421 | ypos 1422 | 1570 1423 | 1424 | A10DF307-B927-4060-A800-9B2A6EC4CA52 1425 | 1426 | xpos 1427 | 270 1428 | ypos 1429 | 1430 1430 | 1431 | A66D4C48-6D6D-4531-AF51-8463E488EEB2 1432 | 1433 | xpos 1434 | 50 1435 | ypos 1436 | 1005 1437 | 1438 | A76FF79E-3778-4855-93AA-20969F1A152A 1439 | 1440 | xpos 1441 | 270 1442 | ypos 1443 | 1710 1444 | 1445 | A8AA5019-512C-4773-83FC-35FEA14DD158 1446 | 1447 | xpos 1448 | 270 1449 | ypos 1450 | 1850 1451 | 1452 | AE15F1F6-37B0-4A47-BEE1-975354A81227 1453 | 1454 | xpos 1455 | 50 1456 | ypos 1457 | 1430 1458 | 1459 | B1C4E5F1-FE5D-4505-9AD6-3F12A4F4ACC8 1460 | 1461 | xpos 1462 | 50 1463 | ypos 1464 | 1710 1465 | 1466 | B8FFA3AB-AD7D-4316-A84F-5958A671D4FF 1467 | 1468 | xpos 1469 | 270 1470 | ypos 1471 | 30 1472 | 1473 | CEEB69A1-B6D7-429F-BEF0-636600076441 1474 | 1475 | xpos 1476 | 270 1477 | ypos 1478 | 310 1479 | 1480 | D3798DBA-B371-47CF-8AB5-E3837B8F876E 1481 | 1482 | xpos 1483 | 270 1484 | ypos 1485 | 450 1486 | 1487 | D5E649CF-505D-458A-913B-ABE9A226E9FA 1488 | 1489 | xpos 1490 | 270 1491 | ypos 1492 | 1290 1493 | 1494 | DDC3EC54-50D5-429B-BFE0-3C06F14766AE 1495 | 1496 | xpos 1497 | 270 1498 | ypos 1499 | 1990 1500 | 1501 | 1502 | userconfigurationconfig 1503 | 1504 | 1505 | config 1506 | 1507 | default 1508 | 1509 | placeholder 1510 | 1511 | required 1512 | 1513 | trim 1514 | 1515 | 1516 | description 1517 | The proxy used for some of the search suggestions. The format is the same as CURLOPT_PROXY. Leave it blank to use no proxy. 1518 | label 1519 | Proxy 1520 | type 1521 | textfield 1522 | variable 1523 | proxy 1524 | 1525 | 1526 | config 1527 | 1528 | default 1529 | 1530 | placeholder 1531 | 1532 | required 1533 | 1534 | trim 1535 | 1536 | 1537 | description 1538 | Your bilibili UID for personalized search suggestions of bilibili. You can find your UID at the personal information section in your personal homepage of bilibili. Leave it blank to disable personalization. 1539 | label 1540 | bilibili UID 1541 | type 1542 | textfield 1543 | variable 1544 | bilibili_uid 1545 | 1546 | 1547 | version 1548 | 1.21 1549 | webaddress 1550 | https://github.com/zqzten/alfred-web-search-suggest 1551 | 1552 | 1553 | -------------------------------------------------------------------------------- /src/joybuy.php: -------------------------------------------------------------------------------- 1 | keyword ?? null; 18 | if (is_null($key)) continue; 19 | $wf->result() 20 | ->title($key) 21 | ->subtitle('Search 京东 for '.$key) 22 | ->arg($key) 23 | ->icon(ICON) 24 | ->autocomplete($key); 25 | } 26 | 27 | echo $wf->output(); 28 | -------------------------------------------------------------------------------- /src/moegirlpedia.php: -------------------------------------------------------------------------------- 1 | result() 20 | ->title($key) 21 | ->subtitle($description) 22 | ->arg($url) 23 | ->icon(ICON) 24 | ->autocomplete($key) 25 | ->copy($key) 26 | ->quicklookurl($url); 27 | } 28 | 29 | echo $wf->output(); 30 | -------------------------------------------------------------------------------- /src/pixiv.php: -------------------------------------------------------------------------------- 1 | candidates; 16 | 17 | foreach ($results as $sugg) { 18 | $key = $sugg->tag_name; 19 | $count = $sugg->access_count; 20 | $wf->result() 21 | ->title($key) 22 | ->subtitle($count.' results') 23 | ->arg($key) 24 | ->icon(ICON) 25 | ->autocomplete($key); 26 | } 27 | 28 | echo $wf->output(); 29 | -------------------------------------------------------------------------------- /src/taobao.php: -------------------------------------------------------------------------------- 1 | result; 15 | 16 | foreach ($result as $sugg) { 17 | $key = $sugg[0]; 18 | $count = round($sugg[1]); 19 | $wf->result() 20 | ->title($key) 21 | ->subtitle($count.' results') 22 | ->arg($key) 23 | ->icon(ICON) 24 | ->autocomplete($key); 25 | } 26 | 27 | echo $wf->output(); 28 | -------------------------------------------------------------------------------- /src/util/download.php: -------------------------------------------------------------------------------- 1 | true, 16 | CURLOPT_URL => $url, 17 | CURLOPT_FRESH_CONNECT => true 18 | ); 19 | 20 | if ($options) 21 | foreach ($options as $k => $v) 22 | $defaults[$k] = $v; 23 | 24 | array_filter($defaults, function($a) { return !empty($a); }); 25 | 26 | $ch = curl_init(); 27 | curl_setopt_array($ch, $defaults); 28 | $out = curl_exec($ch); 29 | $err = curl_error($ch); 30 | curl_close($ch); 31 | 32 | if ($err) 33 | return $err; 34 | else 35 | return $out; 36 | } 37 | -------------------------------------------------------------------------------- /src/vendor/joetannenbaum/alfred-workflow/Result.php: -------------------------------------------------------------------------------- 1 | valid = !!$valid; 39 | 40 | return $this; 41 | } 42 | 43 | /** 44 | * @param string $type (deafult|file|file:skipcheck) 45 | * @param bool $verify_existence When used with $type 'file' 46 | * 47 | * @return \Alfred\Workflows\Result 48 | */ 49 | protected function setType($type, $verify_existence = true) 50 | { 51 | if (in_array($type, ['default', 'file', 'file:skipcheck'])) { 52 | if ($type === 'file' && $verify_existence === false) { 53 | $type = 'file:skipcheck'; 54 | } 55 | 56 | $this->type = $type; 57 | } 58 | 59 | return $this; 60 | } 61 | 62 | /** 63 | * @param string $path 64 | * @param string|null $type (fileicon|filetype) 65 | * 66 | * @return \Alfred\Workflows\Result 67 | */ 68 | protected function setIcon($path, $type = null) 69 | { 70 | $this->icon = [ 71 | 'path' => $path, 72 | ]; 73 | 74 | if (in_array($type, ['fileicon', 'filetype'])) { 75 | $this->icon['type'] = $type; 76 | } 77 | 78 | return $this; 79 | } 80 | 81 | /** 82 | * @param string $path 83 | * 84 | * @return \Alfred\Workflows\Result 85 | */ 86 | protected function setFileiconIcon($path) 87 | { 88 | return $this->setIcon($path, 'fileicon'); 89 | } 90 | 91 | /** 92 | * @param string $path 93 | * 94 | * @return \Alfred\Workflows\Result 95 | */ 96 | protected function setFiletypeIcon($path) 97 | { 98 | return $this->setIcon($path, 'filetype'); 99 | } 100 | 101 | /** 102 | * @param string $subtitle 103 | * 104 | * @return \Alfred\Workflows\Result 105 | */ 106 | protected function setSubtitle($subtitle) 107 | { 108 | $this->subtitle = $subtitle; 109 | 110 | return $this; 111 | } 112 | 113 | /** 114 | * @param string $type (copy|largetype) 115 | * @param string $text 116 | * 117 | * @return \Alfred\Workflows\Result 118 | */ 119 | protected function setText($type, $text) 120 | { 121 | if (!in_array($type, ['copy', 'largetype'])) { 122 | return $this; 123 | } 124 | 125 | $this->text[$type] = $text; 126 | 127 | return $this; 128 | } 129 | 130 | /** 131 | * @param string $copy 132 | * 133 | * @return \Alfred\Workflows\Result 134 | */ 135 | protected function setCopy($copy) 136 | { 137 | return $this->setText('copy', $copy); 138 | } 139 | 140 | /** 141 | * @param string $largetype 142 | * 143 | * @return \Alfred\Workflows\Result 144 | */ 145 | protected function setLargetype($largetype) 146 | { 147 | return $this->setText('largetype', $largetype); 148 | } 149 | 150 | /** 151 | * @param string $mod (shift|fn|ctrl|alt|cmd) 152 | * @param string $subtitle 153 | * @param string $arg 154 | * @param bool $valid 155 | * 156 | * @return \Alfred\Workflows\Result 157 | */ 158 | protected function setMod($mod, $subtitle, $arg, $valid = true) 159 | { 160 | if (!in_array($mod, ['shift', 'fn', 'ctrl', 'alt', 'cmd'])) { 161 | return $this; 162 | } 163 | 164 | $this->mods[$mod] = compact('subtitle', 'arg', 'valid'); 165 | 166 | return $this; 167 | } 168 | 169 | /** 170 | * @param string $subtitle 171 | * @param string $arg 172 | * @param bool $valid 173 | * 174 | * @return \Alfred\Workflows\Result 175 | */ 176 | protected function setCmd($subtitle, $arg, $valid = true) 177 | { 178 | return $this->setMod('cmd', $subtitle, $arg, $valid); 179 | } 180 | 181 | /** 182 | * @param string $subtitle 183 | * @param string $arg 184 | * @param bool $valid 185 | * 186 | * @return \Alfred\Workflows\Result 187 | */ 188 | protected function setShift($subtitle, $arg, $valid = true) 189 | { 190 | return $this->setMod('shift', $subtitle, $arg, $valid); 191 | } 192 | 193 | /** 194 | * @param string $subtitle 195 | * @param string $arg 196 | * @param bool $valid 197 | * 198 | * @return \Alfred\Workflows\Result 199 | */ 200 | protected function setFn($subtitle, $arg, $valid = true) 201 | { 202 | return $this->setMod('fn', $subtitle, $arg, $valid); 203 | } 204 | 205 | /** 206 | * @param string $subtitle 207 | * @param string $arg 208 | * @param bool $valid 209 | * 210 | * @return \Alfred\Workflows\Result 211 | */ 212 | protected function setCtrl($subtitle, $arg, $valid = true) 213 | { 214 | return $this->setMod('ctrl', $subtitle, $arg, $valid); 215 | } 216 | 217 | /** 218 | * @param string $subtitle 219 | * @param string $arg 220 | * @param bool $valid 221 | * 222 | * @return \Alfred\Workflows\Result 223 | */ 224 | protected function setAlt($subtitle, $arg, $valid = true) 225 | { 226 | return $this->setMod('alt', $subtitle, $arg, $valid); 227 | } 228 | 229 | /** 230 | * Converts the results to an array structured for Alfred 231 | * 232 | * @return array 233 | */ 234 | public function toArray() 235 | { 236 | $attrs = [ 237 | 'uid', 238 | 'arg', 239 | 'autocomplete', 240 | 'title', 241 | 'subtitle', 242 | 'type', 243 | 'valid', 244 | 'quicklookurl', 245 | 'icon', 246 | 'mods', 247 | 'text', 248 | ]; 249 | 250 | $result = []; 251 | 252 | foreach ($attrs as $attr) { 253 | if (is_array($this->$attr)) { 254 | if (count($this->$attr) > 0) { 255 | $result[$attr] = $this->$attr; 256 | } 257 | continue; 258 | } 259 | 260 | if ($this->$attr !== null) { 261 | $result[$attr] = $this->$attr; 262 | } 263 | } 264 | 265 | ksort($result); 266 | 267 | return $result; 268 | } 269 | 270 | public function __get($property) 271 | { 272 | return $this->$property; 273 | } 274 | 275 | public function __call($method, $args) 276 | { 277 | $setter = 'set' . ucwords($method); 278 | 279 | if (method_exists($this, $setter)) { 280 | call_user_func_array([$this, $setter], $args); 281 | 282 | return $this; 283 | } 284 | 285 | if (property_exists($this, $method)) { 286 | $this->$method = reset($args); 287 | 288 | return $this; 289 | } 290 | } 291 | } 292 | -------------------------------------------------------------------------------- /src/vendor/joetannenbaum/alfred-workflow/Workflow.php: -------------------------------------------------------------------------------- 1 | results[] = $result; 20 | 21 | return $result; 22 | } 23 | 24 | /** 25 | * Add a variables to the workflow 26 | * 27 | * @param string $key 28 | * @param string $value 29 | * 30 | * @return \Alfred\Workflows\Workflow 31 | */ 32 | public function variable($key, $value) 33 | { 34 | $this->variables[$key] = $value; 35 | 36 | return $this; 37 | } 38 | 39 | /** 40 | * Sort the current results 41 | * 42 | * @param string $direction 43 | * @param string $property 44 | * 45 | * @return \Alfred\Workflows\Workflow 46 | */ 47 | public function sortResults($direction = 'asc', $property = 'title') 48 | { 49 | usort($this->results, function ($a, $b) use ($direction, $property) { 50 | if ($direction === 'asc') { 51 | return $a->$property > $b->$property; 52 | } 53 | 54 | return $a->$property < $b->$property; 55 | }); 56 | 57 | return $this; 58 | } 59 | 60 | /** 61 | * Filter current results (destructive) 62 | * 63 | * @param string $query 64 | * @param string $property 65 | * 66 | * @return \Alfred\Workflows\Workflow 67 | */ 68 | public function filterResults($query, $property = 'title') 69 | { 70 | if ($query === null || trim($query) === '') { 71 | return $this; 72 | } 73 | 74 | $query = (string) $query; 75 | 76 | $this->results = array_filter($this->results, function ($result) use ($query, $property) { 77 | return strstr($result->$property, $query) !== false; 78 | }); 79 | 80 | return $this; 81 | } 82 | 83 | /** 84 | * Output the results as JSON 85 | * 86 | * @return string 87 | */ 88 | public function output() 89 | { 90 | $output = [ 91 | 'items' => array_map(function ($result) { 92 | return $result->toArray(); 93 | }, array_values($this->results)), 94 | ]; 95 | 96 | if(!empty($this->variables)){ 97 | $output['variables'] = $this->variables; 98 | }; 99 | 100 | return json_encode($output); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/wikipedia.php: -------------------------------------------------------------------------------- 1 | result() 25 | ->title($key) 26 | ->subtitle($description) 27 | ->arg($url) 28 | ->icon(ICON) 29 | ->autocomplete($key) 30 | ->copy($key) 31 | ->quicklookurl($url); 32 | } 33 | 34 | if (count($json[1]) === 0) { 35 | $wf->result() 36 | ->title('No Suggestions') 37 | ->subtitle('No search suggestions found. Search Wikipedia.'.$code.' for '.$query) 38 | ->arg("https://$code.wikipedia.org/w/index.php?search=".urlencode($query)) 39 | ->icon(ICON) 40 | ->copy($query); 41 | } 42 | } 43 | 44 | echo $wf->output(); 45 | -------------------------------------------------------------------------------- /src/wolframalpha.php: -------------------------------------------------------------------------------- 1 | results; 15 | 16 | foreach ($results as $sugg) { 17 | $key = $sugg->input; 18 | $description = $sugg->parseType; 19 | $wf->result() 20 | ->title($key) 21 | ->subtitle($description) 22 | ->arg($key) 23 | ->icon(ICON) 24 | ->autocomplete($key); 25 | } 26 | 27 | echo $wf->output(); 28 | -------------------------------------------------------------------------------- /src/zhihu.php: -------------------------------------------------------------------------------- 1 | suggest; 15 | 16 | foreach ($suggest as $sugg) { 17 | $query = $sugg->query; 18 | $wf->result() 19 | ->title($query) 20 | ->subtitle('Search 知乎 for '.$query) 21 | ->arg($query) 22 | ->icon(ICON) 23 | ->autocomplete($query); 24 | } 25 | 26 | echo $wf->output(); 27 | --------------------------------------------------------------------------------