Added the Stackoverflow fetcher: bring stackoverflow to the console where you already are#51
Added the Stackoverflow fetcher: bring stackoverflow to the console where you already are#51augnustin wants to merge 1 commit into
Conversation
|
this seems interesting but implemented as a fallback like now it is conflicting with the new behavior of of Betty giving help and sample messages. Can you make it like a normal Module that is driven by queries like: $ betty search stack for how to install cmus
$ betty stackoverflow more votes for how to install cmus
$ betty stackoverflow best answer for how to install cmus
$ betty stackover best answer for how to install cmusAlso make it in a new branch from current dev. |
|
Yes, I tested it around a little bit and I agree that I encountered weird behaviors sometimes. I'll make an update 😄 |
|
Great to hear that! |
|
I was really excited to see this StackOverflow feature, but the API key is a bit of a pain. I have a similar tool for pulling SO snippets (https://github.com/djbutler/oflow) which uses one of Google's undocumented JSON endpoints and does not require an API key, it might be nice to use the same setup here. |
|
I updated my PR with a regular module for the queries Among the possible improvements:
|
|
@djbutler I checked on how your code work. The only sad thing about this is that your code uses an API that is depreciated:
That could be a decent workaround to use it as long as it is still working, but it won't last forever ... Another possibility would be to get and install the api key during the It is super interesting to see how close your oflow script is from this one! It confirms that there's a need for this! |
|
This is cool, but whose api key is this?
|
|
@aug-riedinger Yeah it's not ideal. There's yet another incarnation of this idea here: https://github.com/gleitz/howdoi |
|
@pickhardt Everyone with a google account can create as many projects as possible and each project can activate its own API keys. The one in the example file is given away to test it around, but it is not the one I use on my computer. @djbutler I thought crawling the web was the worst practice ever (though in this case, it is only about automating the query we would make in the browser anyway ...) I agree those solutions are not ideal. Here are the possible solutions I see:
Any insight which one you'd rather have? Stupid API limitations ... |
|
When you say given away, who is giving it away? Wouldn't everyone need to just fetch their own API key? In that case, I agree with your last solution: "automate the project creation + API key fetching" Assuming that is straight-forward to do. Mineswell have everyone get their own API key. |
|
My account, but on an unpaid one so it'll stop making calls when the limit is reached. I'll have a look at the last one then. |
Added the Stackoverflow fetcher: if a query did not return any result, it fetches google with the query and displays the first Stackoverflow result.
Backward compatibility should be ok, but many changes were involved. Among others:
Readme.mdwas updated too, with installation details (to get API Key). Theconfig.rb.examplefile has a working API KEY to get an example working straightaway.Hope you enjoy it, I already love it!