First of all, thanks for creating this plugin for Alfred!
I have followed the tutorials to create an extension to access my Youtube video data. Usually I need to retrieve title or description to reuse it somewhere else. I was planning to share it with in Packal so other people can use it too. I created this description of how it works:
Youtube Video Search
This workflow retreives details about your latest videos from Youtube.
To set it up, you need to configure your Youtube ChannelID and API Key. To do so execute the following commands:
- ytsetkey: Without parameters, it will take you to the Youtube API page to get your API key. If you supply your API Key as a parameter, it will be stored in your Keychain (and synced among devices).
- ytsetchannel: Without parameters, it will take you to Youtube Advance Setting page to retrieve your channel ID. If you pass the channel ID as a parameter, it will be stored in the workflow settings.
It has the following keywords defined:
- ys (Youtube Search): retrieves the latest 50 posts from your Youtube account. When you press enter on the results, the video ID will be copied to your clipboard.
- yo (Youtube Open): takes a video ID as a parameter and opens the Youtube video website for that video.
- yd (Youtube Details): takes a video ID as a parameter and lists the video details. Pressing enter will copy the result to the clipboard.
If you ever need to reset this workflow parameters, you can do so using the Magic argument: ys workflow:delsettings.
Bugs: VideoIDs starting with hypens, breaks the yd call.
---------
So far everything is working but the Youtube Details keyword. It works if:
a) Running from the console and passing the parameter, returns correct results.
b) Disabling cache in the code and passing static parameter, returns correct results.
If I try to make it run, it shows the correct message and reverts to default search in a second.
I have tried the debug option in Alfred and my hypothesis is:
a) Alfred evaluates yd as I finish typing d (after y)
b) It evaluates query as empty and passes that as a parameter to get_video_details
c) Query is sent to Youtube, but it lacks video_id, so it's incomplete.
d) It returns a JSON that is an empty list (JSON is {u'items': [], u'kind': u'youtube#videoListResponse', u'etag': u'"nlUZBA6NbTS7q9G8D1GljyfTIWI/Rk41fm-2TD0VG1yv0-bkUvcBi9s"', u'pageInfo': {u'resultsPerPage': 0, u'totalResults': 0}}
e) This empty list is cached
f) All following searchs are launched against cached data, returning empty responses.
Argument is set to "Argument Required"
Is there any way to have Alfred to wait until pressing Enter or Tab before launching the Script Filter?