yagop / telegram-bot

UNMAINTAINED - A Telegram Bot based on plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error en el comando !img de Google

robotrono opened this issue · comments

Bueno ahora resulta que al poner el comando para buscar una imagen en google nos muestra el siguiente error:
ERROR: Reached maximum searches per day

¿que se puede hacer?

The maximum search error is just a standard error message in case a 403 is returned by the API.
Checked the API via curl.

curl "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=5&q=test"
{"responseData": null, "responseDetails": "This API is no longer available.", "responseStatus": 403}

Looks like Googles image search API is no more :-(

is there an alternative?

I have an example of my new img_google.lua file here: http://moaifiddle.com/36Q4GYJRR2/1

You can create a cx token following these rules: http://stackoverflow.com/a/34062567
You can create apikeys by adding server keys on: https://console.developers.google.com/apis/credentials (I created 5, because you can only do 100 requests per day per apikey)

It is important that your data/google.lua looks like this:

do local _ = {
cx = "12345678901234567890:qwertyuiop",
api_keys = {
"SOMEAPIKEY1",
"SOMEAPIKEY2",
"SOMEAPIKEY3",
"SOMEAPIKEY4",
"SOMEAPIKEY5"
}
}
return _
end

Is there a way to enable safesearch? safe=active does not work anymore.

I found this script for a decentralised, offline search engine:
https://github.com/asciimoo/searx/blob/master/searx/engines/qwant.py

For example
https://api.qwant.com/api/search/images?count=10&offset=1&f=&q=cars

It's not Google, but you can use that API to search for images and to my knowledge there isn't a limit on the API. It would require some tweaking though.

Is there a way to enable safesearch? safe=active does not work anymore.

The new parameters are: off, medium, high

kvanhoorn >> Image not found :(

commented

@kvanhoorn
I receive the same message as Gusiky.

Image not found

@Gurskiy @lexzz did you set the option for image search to true? See attachment

screen shot 2015-12-04 at 11 42 05

commented

@kvanhoorn Changed the setting (wasn't set) but still receive the same message

@kvanhoorn /basic?cx=014517009909333815812:oi6s3rfph1e

commented

@kvanhoorn /basic?cx=011344415500081287727:o475mc2u9fg

message": "Access Not Configured. The API (CustomSearch API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
"extendedHelp": "https://console.developers.google.com"

Yeah! Everything is ok now thank you!

@Gurskiy Click on the url, go to "Enable APIs and get credentials like keys" and choose "Other popular APIs" -> "Custom Search API" and enable it.

commented

@kvanhoorn Problem solved! Thank you!

Hmmm. Now i have

{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceeded",
"message": "Daily Limit Exceeded"
}
],
"code": 403,
"message": "Daily Limit Exceeded"
}
}

on all my 10 api

commented

Thank you @kvanhoorn

commented

@drig0 Go to https://cse.google.com/cse/all, choose your custom search engine and toggle the first switch ("image search")

commented

@Brawl345 thanks

then follow step by step, yet I find myself with the following message,
no images found

Can anyone modify plugin to use Duckduckgo api? (https://duckduckgo.com/api)

commented

DDG doesn't have an image api

DDG doesn't have an image api

I'm not sure at all, but I would say that the same API can be used to search images, using the &ia=images param.