keshrath / giphy4j Goto Github PK
View Code? Open in Web Editor NEWA Java library for the Giphy API.
License: GNU General Public License v3.0
A Java library for the Giphy API.
License: GNU General Public License v3.0
Hi guys,
your lib is very convenient and easy to use : it does perfectly fit my needs ...at an exception : i didn't find how to query gifs with the downsize. I could not find sample code to do that :
SearchRandom giphyData = giphy.searchRandomS("Happy birthday");
In my case, i make a random search and want to be sure that the gif will be displayed. Iwas the downsized param, i guess it's the good one.
Sticketrs are nice and seem to be lighter but it seems like there are more funny gifs than stickers.
Could you share some code snippet on your README.md to show how to achieve this please ?
Thank you in advance for your help.
Kind Regards,
Adrien
Sometimes, I get the following error:
ERROR at.mukprojects.giphy4j.Giphy - java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 10 path $.data
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 10 path $.data
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at at.mukprojects.giphy4j.Giphy.searchRandom(Giphy.java:258)
at io.beekeeper.bots.giphy.GiphyChatBot.getRandomImageByTag(GiphyChatBot.java:59)
at io.beekeeper.bots.giphy.GiphyChatBot.onNewMessage(GiphyChatBot.java:40)
at io.beekeeper.sdk.ChatBot.handleMessage(ChatBot.java:44)
at io.beekeeper.sdk.MessageListenerImpl.lambda$process$0(MessageListenerImpl.java:90)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 10 path $.data
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
... 16 more
I suspect an error result, which is not parsed correctly. Am I right?
It looks like there are some tags, which don't have gifs or something... That kills the package.
java.lang.NoClassDefFoundError: at/mukprojects/giphy4j/Giphy at me.WattMann.listeners.GifCommand.onMessageReceived(GifCommand.java:21) at net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:417) at net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84) at net.dv8tion.jda.core.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:122) at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37) at net.dv8tion.jda.core.requests.WebSocketClient.onDispatch(WebSocketClient.java:1051) at net.dv8tion.jda.core.requests.WebSocketClient.onEvent(WebSocketClient.java:911) at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:890) at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1089) at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368) at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270) at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990) at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749) at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108) at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64) at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45) Caused by: java.lang.ClassNotFoundException: at.mukprojects.giphy4j.Giphy at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 16 more
might just be me but when using getUrl(), it doesnt return the exact url but GifData. e.g
SearchFeed [
GifData [
id = ulDKf3pH7wqfC
slug = ulDKf3pH7wqfC
url = https://giphy.com/gifs/ulDKf3pH7wqfC
GifImage (Original) [
url = https://media3.giphy.com/media/ulDKf3pH7wqfC/giphy.gif
width = 216
height = 288
size = 374533
frames = 30
mp4 = https://media3.giphy.com/media/ulDKf3pH7wqfC/giphy.mp4
mp4Size = 40500
webp = https://media3.giphy.com/media/ulDKf3pH7wqfC/giphy.webp
webpSize = 133728
]
]
Meta [status = 200, msg = OK]
Pagination [totalCount = 1370, count = 1, offset = 0]
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.