Jump to content

wesbaker

Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by wesbaker

  1. Sorry to resurrect this topic, but the workflow is broken (I suspect Kickstarter updated their API?). Any chance of an update, please?

     

    No worries, I was having similar problems. Kickstarter didn't actually change anything, I think the problem was related to Alfred's PHP framework, something changed. It's all fixed now since I'm just using native PHP. The downloads above have been updated.

  2. I saw something of a response and then it returned with no results, the second time I tried (results in the feedback.log) nothing showed up and it went to the fallback search engines.

     

    Also, there was an error in the console.log. I'll try my hand at debugging it a bit further tomorrow to see if I can find the problem as well.

    <items>
        <item arg="http://www.amazon.com/The-Last-Threshold-Neverwinter-ebook/dp/B00A1M5EH6%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB00A1M5EH6" uid="B00A1M5EH6">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/5161L4VFLaL._SL75_.jpg</icon>
            <subtitle>R. A. Salvatore—Price Missing</subtitle>
            <title>The Last Threshold: Neverwinter Saga, Book IV</title>
        </item>
        <item arg="http://www.amazon.com/The-Companions-Sundering-Book-ebook/dp/B00BE24W0W%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB00BE24W0W" uid="B00BE24W0W">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/515jwovI15L._SL75_.jpg</icon>
            <subtitle>R. A. Salvatore—Price Missing</subtitle>
            <title>The Companions: The Sundering, Book I</title>
        </item>
        <item arg="http://www.amazon.com/Charons-Claw-Neverwinter-Saga-ebook/dp/B0078XCSRA%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0078XCSRA" uid="B0078XCSRA">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/51pTm3N%2BnBL._SL75_.jpg</icon>
            <subtitle>R.A. Salvatore—Price Missing</subtitle>
            <title>Charon's Claw: Neverwinter Saga, Book III</title>
        </item>
        <item arg="http://www.amazon.com/Gauntlgrym-Neverwinter-Odyssey-Cycle-ebook/dp/B003WUYOTI%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB003WUYOTI" uid="B003WUYOTI">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/51CAqjsQOAL._SL75_.jpg</icon>
            <subtitle>R.A. Salvatore—$7.99</subtitle>
            <title>Gauntlgrym: Neverwinter Saga, Book I (Odyssey Cycle)</title>
        </item>
        <item arg="http://www.amazon.com/Neverwinter-The-Saga-Book-ebook/dp/B004Y1Q762%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB004Y1Q762" uid="B004Y1Q762">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/51As%2BAIBVDL._SL75_.jpg</icon>
            <subtitle>R.A. Salvatore—$27.95</subtitle>
            <title>Neverwinter: The Neverwinter Saga, Book II</title>
        </item>
        <item arg="http://www.amazon.com/Homeland-Legend-Drizzt-Book-ebook/dp/B002DOSBMK%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB002DOSBMK" uid="B002DOSBMK">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/51LlcrT926L._SL75_.jpg</icon>
            <subtitle>R.A. Salvatore—$7.99</subtitle>
            <title>Homeland: The Legend of Drizzt, Book I: Bk. 1</title>
        </item>
        <item arg="http://www.amazon.com/Weight-Blood-Half-Orcs-Book-ebook/dp/B0036R4JU6%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0036R4JU6" uid="B0036R4JU6">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/51SugQW3KvL._SL75_.jpg</icon>
            <subtitle>David Dalglish—$0.99</subtitle>
            <title>The Weight of Blood (The Half-Orcs, Book 1)</title>
        </item>
        <item arg="http://www.amazon.com/The-Orc-King-Transitions-ebook/dp/B0013TTKUI%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0013TTKUI" uid="B0013TTKUI">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/51%2BriQVpCFL._SL75_.jpg</icon>
            <subtitle>R.A. Salvatore—$7.99</subtitle>
            <title>The Orc King: Transitions, Book I</title>
        </item>
        <item arg="http://www.amazon.com/Dungeons-Dragons-Drizzt-Neverwinter-ebook/dp/B009CI6TLA%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB009CI6TLA" uid="B009CI6TLA">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/51PPyhG20hL._SL75_.jpg</icon>
            <subtitle>R.A. Salvatore—Price Missing</subtitle>
            <title>Dungeons & Dragons: Drizzt - Neverwinter Tales</title>
        </item>
        <item arg="http://www.amazon.com/Passage-Dawn-Legend-Drizzt-ebook/dp/B002DO17LM%3FSubscriptionId%3DAKIAIJ2QMIHPYL6UNHTA%26tag%3Ddanishan-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB002DO17LM" uid="B002DO17LM">
            <icon>/Users/wes/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.danielsh.alfred.kindlestore/covercache/511GIeqvAoL._SL75_.jpg</icon>
            <subtitle>R.A. Salvatore—$7.99</subtitle>
            <title>Passage to Dawn: The Legend of Drizzt, Book X</title>
        </item>
    </items>
    
  3. Ahh, never mind me. I figured it out. The second parameter in 

    $wf->result()

    is the parameter that gets passed on. Here's the updated code:

    require_once('workflows.php');
    $wf = new Workflows();
    
    $orig = "{query}";
    $json = $wf->request("http://www.kickstarter.com/projects/search.json?search=&term=".urlencode($orig));
    $json = json_decode($json);
    
    foreach($json->projects as $project)
    {
    	$url = (preg_match('/<a href="(.*?)\?ref=live/i', $project->card_html, $matches)) ? 'http://kickstarter.com'.html_entity_decode($matches[1]) : '';
    	$funded = (preg_match('/class=".*?funded".*?<strong>(.*?)<\/strong>/is', $project->card_html, $matches)) ? $matches[1] : '';
    	$pledged = (preg_match('/class="pledged".*?<strong>(.*?)<\/strong>/is', $project->card_html, $matches)) ? $matches[1] : '';
    	$by = (preg_match('/<span>\s*by(.*?)\s*<\/span>/is', $project->card_html, $matches)) ? trim($matches[1]) : '';
    $successful = (stripos($project->card_html, 'project-pledged-successful">') !== FALSE) ? TRUE : FALSE;
    	$failed = (stripos($project->card_html, 'project-failed') !== FALSE) ? TRUE : FALSE;
    	$status = ($successful OR $failed) ? 'Inactive' : 'Active';
    	$project->name = html_entity_decode($project->name, ENT_QUOTES);
    	$wf->result($project->id, $url, $project->name, "{$status} | by {$by} | {$funded} funded | {$pledged} pledged", 'icon.png');
    }
    
    $results = $wf->results();
    if ( count( $results ) == 0 )
    {
    	$wf->result( 'googlesuggest', $orig, 'No Suggestions', 'No search suggestions found. Search Google for '.$orig, 'icon.png' );
    }
    
    echo $wf->toxml();
    

    And here's the download.

  4. Hey there, I'm trying to build a Kickstarter workflow that uses their suggestion engine and then directs you to the project's URL. I'm using David Ferguson's PHP Workflow library and basing it heavily off of Google Suggest. I'm retrieving the results just fine and I have the URL, but how do I then pass that URL to the Open URL Output item?

    require_once('workflows.php');
    $wf = new Workflows();
    
    $orig = "{query}";
    $json = $wf->request("http://www.kickstarter.com/projects/search.json?search=&term=".urlencode($orig));
    $json = json_decode($json);
    
    foreach($json->projects as $project)
    {
    	$url = (preg_match('/<a href="(.*?)\?ref=live/', $project->card_html, $matches)) ? $matches[1] : '';
    	$wf->result( $project->id, $project->name, $project->name, 'View '.$data.' on Kickstarter', 'icon.png');
    }
    
    $results = $wf->results();
    if ( count( $results ) == 0 )
    {
    	$wf->result( 'googlesuggest', $orig, 'No Suggestions', 'No search suggestions found. Search Google for '.$orig, 'icon.png' );
    }
    
    echo $wf->toxml();
    
×
×
  • Create New...