-
-
Save yoshimana/ef640cfb25bc5d739bfcb585d929d775 to your computer and use it in GitHub Desktop.
AlfredのGoogle Suggest Workflowのスクリプトフィルタを編集して、日本語の候補がより多く表示されるように改変したものです
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once('workflows.php'); | |
$wf = new Workflows(); | |
$orig = "{query}"; | |
$xml = $wf->request( "http://google.co.jp/complete/search?hl=ja&ie=utf_8&oe=utf_8&output=toolbar&q=".urlencode( $orig ) ); | |
$xml = simplexml_load_string( $xml ); | |
$int = 1; | |
foreach( $xml as $sugg ): | |
$data = $sugg->suggestion->attributes()->data; | |
$wf->result( $int.'.'.time(), "$data", "$data", 'Search Google for '.$data, 'icon.png' ); | |
$int++; | |
endforeach; | |
$results = $wf->results(); | |
if ( count( $results ) == 0 ): | |
$wf->result( 'googlesuggest', $orig, 'No Suggestions', 'No search suggestions found. Search Google for '.$orig, 'icon.png' ); | |
endif; | |
echo $wf->toxml(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment