DiscordBot icon indicating copy to clipboard operation
DiscordBot copied to clipboard

Move to new Google custom search API

Open shiburizu opened this issue 11 years ago • 5 comments

The image search API was taken down and gives "Error: API no longer available" when using !image commands. https://stackoverflow.com/questions/34035422/google-image-search-says-api-no-longer-available The issue is described here.

shiburizu avatar Dec 02 '15 18:12 shiburizu

I just pushed a first pass at this in 8d308e8. Not actually tested because I don't have any API keys set up. @chalda can you make a custom search for your API key and test?

Einarin avatar Dec 07 '15 00:12 Einarin

Adding a custom search w/API causes an internal server (500) error. Exact line as follows:

treating !image test from <@106092807336280064> as command { error: { code: 500, message: null } }

SchwererKonigstiger avatar Dec 08 '15 15:12 SchwererKonigstiger

@Einarin wrote in your changes to the image search plugin...still getting an "undefined" from the bot however. When you added the ability for the console to log the data being returned I was given this: http://i.imgur.com/8ievEVv.png Text output: http://pastebin.com/1HLUxgyQ

I assume that we're looking for ".responseData" which is not a returnable set of information.

shiburizu avatar Dec 12 '15 02:12 shiburizu

Nice @shiburizu! It looks like this has a totally different JSON structure than the old google images api. .responseData used to be the image URL. Looks like now we want something like:

bot.sendMessage(msg.channel, data.item[0].title + '\n' + data.item[0].link);

I started on this before but then dropped it when it didn't just work. I'll take another look at it.

Einarin avatar Dec 12 '15 03:12 Einarin

Fixed. Thanks @shiburizu for all your help on this! 00cba108fd039288089d5c171f2f87c7cba086e3

Einarin avatar Dec 12 '15 04:12 Einarin