Closed gyoza closed 9 years ago
What version are you using? Anything interesting in the Hubot logs?
Just updated the script to try to fix this issue. Still having the same results using the old API. Don't have a CSE set up.
I used the latest version available here.
+1 having the same issue here
The deprecated API results seem to not honor imgtype=animated anymore
https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&q=cute+kittens&safe=active&imgtype=animated
Gives the same results as without the imgtype defined. That parameter is listed as "experimental" in the documentation so maybe the experiment is over?
We have great success animating with the CSE version.
@HaroldPutman Any idea where to get the CSE ID? When I use the default google search engine it gives me errors.. Any tips would be appreciated.
@gyoza Information on how to setup Google CSE is here: https://developers.google.com/custom-search/docs/tutorial/creatingcse
I figured it out... it is because I did not have "images" turned on :) Thanks for the link though!
Man, 100 queries a day is a huge drag :(
You know a ghetto way to do this is to add the as_filetype=gif to the list and then deconstruct the top 10 results in question to see if they have more than one frame (aka a real gif) and post that image. ha... its super ghetto but if they decide to never "fix" this for us and we dont want to be limited to 100 queries a day it may be something worth looking into..
Not a bad thought. Heck, just restricting to .gif files would increase the odds of getting an animated image result.
+1 We're seeing the same issue.
What's interesting is that we sometimes get a gif, sometimes not. The gifs are rare, but we're not getting only images when using animate me
.
@gyoza that approach may not be so ghetto. The CSE version limits the results to gif and includes "AND animated" in the query. There's no other option for this in the new API. This works most of the time.
FWIW, we have a team of 40 developers and have not ever had more that 45 image queries in a day. But maybe we're not as fun as most people :smirk_cat:
Can someone furnish an example? I have created a Custom Search Engine and a project in the Developers Console, but I'm getting 404 errors from hubot.
Did you set the environment variables before starting hubot? Something like this (obviously using your real ids and keys)
export HUBOT_GOOGLE_CSE_ID=0493...7K
export HUBOT_GOOGLE_CSE_KEY=GGP...bsX
@HaroldPutman OK, I was using a Project ID instead of the CSE Key. I can't find this value anywhere :-/
Find the key here: Visit https://code.google.com/apis/console select your project and then choose Credentials under APIs & Auth.
Got it :trophy:
@HaroldPutman: Thank you. Without your help I would still be looking.
To clarify the steps a bit
hubot animate me gravy
Thanks all!
I'm having trouble setting up the Google CSE. I've following the instructions provided previously linked to, but when I search for "gravy" it only returns patent application data. Can someone help me ensure I have the right options selected for CSE (screenshot of CSE Control Panel below). The main question is what site should I specify to search through? (I assumed www.google.com).
When I use the query URL in the browser this is the response I get. It is working, but not in the way this hubot extension expects. There's no res.statusCode
returned, so hubot-google-images responds with a 400 error.
Thanks for the help.
@jasonleibowitz I think you needed to add at least one site to create the search engine.
But then you should remove them and change the "Sites search" option:
(Or, at least, that has worked for me.)
@alehandrof That was the answer. Thank you so much!
Worked for me as well. This was way too complicated.
Worked for me. Thank you everyone for the help!
I'm not sure if CSE is the best option, given the artificially low API request limit that Google is imposing. Our team is more active with our hubot and we burned through our request limit in ~4 hours.
I was able to add the as_filetype
parameter to the deprecated API request and get GIFs back, but @gyoza 's method will be required to root out the single-frame GIFs. It might be worth putting into the code-base if it means that this project can continue support limitless GIF getting via the deprecated API.
I was able to get the giphy option working. Should I submit a pull request for this? Are there any reasons to not go with giphy?
@liquidmetal if you can implement as an option, pull request are very welcome!
Is anyone else not a huge fan of Giphy's results? I've always found that animate me
in Hubot is miles better than Slack's /giphy
integration. Not sure why that is the case though.
@danoc you're not alone. It's because giphy doesn't have access to the same amount of image that Google have. And they are often mislabeled.
But having it as an option is better than nothing at all.
Here is another ghetto method that we've come up with..
We've setup 10 google search accounts and we've setup our hubot to restart every hour and switch to the next account...That gives you 1000 queries a day... That is a lot.. Ghetto fabulous, but requires no forking of the code and figuring image manipulation techniques etc..
@gyoza Ohhh that's an interesting idea. Would probably solve the issue for my team's needs. I might look into setting up a rotation for the accounts so that Hubot doesn't need to be restarted, but otherwise I think that'll work wonderfully.
@gyoza @Sarkazein I could be wrong - but that probably violates the T&C of using the API.
Darn... should have thought of that. Oh well, we'll have to see how far 100 per day gets us.
Fixed in version 0.2.2 with PR #12
Hi what value should HUBOT_GOOGLE_SAFE_SEARCH get ? '0' , 'off', 'false' is not working
The value of HUBOT_GOOGLE_SAFE_SEARCH is assigned to the "safe" parameter in the search request. If you are using the CSE API it can have a value of "high", "medium", or "off". If you are using the deprecated API it can have a value of "active", "moderate" or "off".
What makes you believe that "off" is not working?
@HaroldPutman Thats my var config:
http://creativecast.de/mba/cs-hodor_·_Settings___Heroku_1BF23C25.png
And when i'm testing with f.e nude girl query it end up with different result than on google images search (with safesearch off)
Make sure you are running the latest code. This is a relatively new feature (v0.2.3). check node_modules/hubot-google-images/src/google-images.coffee and make sure you find HUBOT_GOOGLE_SAFE_SEARCH referenced in there.
If that is not the issue check the configuration of your Custom Search Engine.
I'm haven't tested this feature myself, but I assume it works for @taviscaron who submitted the PR.
On Tue, Nov 10, 2015 at 9:53 AM, Marek Badura notifications@github.com wrote:
@HaroldPutman https://github.com/HaroldPutman Thats my var config:
http://creativecast.de/mba/cs-hodor_·_Settings___Heroku_1BF23C25.png
And when i'm testing with f.e nude girl query it end up with different result than on google images search (with safesearch off)
— Reply to this email directly or view it on GitHub https://github.com/hubot-scripts/hubot-google-images/issues/10#issuecomment-155440834 .
Harold PUTMAN Web Technology Specialist
O +1 859 232 2839 M +1 859 904 9735 harold.putman@lexmark.com email@lexmark.com
http://www.lexmark.com/ www.lexmark.com
Confirm this. HUBOT_GOOGLE_SAFE_SEARCH=off
works for both CSE and deprecated API
@HaroldPutman : yes i'm running latest code
q =
q: query,
searchType:'image',
safe: process.env.HUBOT_GOOGLE_SAFE_SEARCH || 'high',
Can you tell me more about CSE settings ? I can see in developers console that its working. I user "Browser API Key" , maybe here's the issue ?
and
heroku config:get HUBOT_GOOGLE_SAFE_SEARCH
off
and output for nude girl:
@HaroldPutman @alehandrof @jasonleibowitz
Followed your example above but I'm still getting an empty body
object returned when making the request. The result is all requests default to this line of code, aka "Oops. I had trouble searching..."
My res.statusCode
is still 200 though, and i'm using the latest version. Here's what the logs say
vocbot animate me trump
vocbot> [Tue Dec 08 2015 13:42:17 GMT-0800 (PST)] DEBUG Message 'vocbot animate me trump' matched regex //^\s*[@]?vocbot[:,]?\s*(?:animate( me)? (.+))/i/; listener.options = { id: null }
[Tue Dec 08 2015 13:42:17 GMT-0800 (PST)] DEBUG Executing listener callback for Message 'vocbot animate me trump'
[Tue Dec 08 2015 13:42:17 GMT-0800 (PST)] DEBUG Message 'vocbot animate me trump' matched regex //.*//; listener.options = { id: null }
[Tue Dec 08 2015 13:42:17 GMT-0800 (PST)] DEBUG Executing listener callback for Message 'vocbot animate me trump'
Oops. I had trouble searching 'trump'. Try later.
I'm experiencing the same thing as @geraldarthur. I followed the instructions, but every time I run "image me", Hubot says Oops. I had trouble searching 'foo'. Try later.
i'm getting results 4fold and sometimes timeouts, key and id are good.
No longer getting gifs when using animate... Not entirely sure why, is there something that has been changed or is the since depreciated search API now defunct? Thanks.