jinzulen / tenorjs Goto Github PK
View Code? Open in Web Editor NEWFeature-rich client for Tenor.
License: Apache License 2.0
Feature-rich client for Tenor.
License: Apache License 2.0
Failed to parse retrieved JSON.
Description
The GIF does not load when it's requested. (Using DiscordJS)
To Reproduce
Steps to reproduce the behavior:
Actually, the GIF does not load.
Screenshots
The image shows the else
statement, but it changes nothing as it's just a copy-paste. (The only one edit is that the embed description is not the username by the mention.
Additional context
Code:
const tenor = require("tenorjs").client({
"Key": config.tenor,
"Filter": "off",
"Locale": "en_US",
"MediaFilter": "basic",
"DateFormat": "D/MM/YYYY - H:mm:ss A"
});
if (msg.mentions.users.first()) {
var user = msg.mentions.users.first();
if (!msg.guild.member(user)) return msg.channel.send(":x: Cet utilisateur n'est pas sur le serveur !");
tenor.Search.Random("anime kiss", 1).then(gif => {
var embed = new discord.MessageEmbed()
.setAuthor(msg.author.username, msg.author.avatarURL())
.setColor(randomColor())
.setDescription(`${msg.author.username} fait un bisou à ${user.username} 😊`)
.setImage(gif[0].url)
.setTimestamp(new Date())
.setFooter("FlamesBot©", bot.user.avatarURL())
msg.channel.send(embed);
});
}
Describe the bug
"SyntaxError: Unexpected end of JSON input" returned after queries
To Reproduce
Steps to reproduce the behavior:
Using the tenorjs client while filter is set on high and locale is set to en_US some API queries will return an "Unexpected end" of the JSON Input.
This seems to occur whenever I am calling queries in quick succession but the query term that has always replicated this issue is "lol", which works fine on the tenor website but creates this error within using the API.
Additional context
I'm using handlebars, nodemon, and express for this as part of a class project.
1.0.7 is the version I am using.
Describe the bug
When a query is issued with a high enough limit, the library throws the following exception:
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (/<snip>/node_modules/tenorjs/src/Tools/Utilities.js:52:38)
at IncomingMessage.emit (events.js:314:20)
at IncomingMessage.Readable.read (_stream_readable.js:513:10)
at flow (_stream_readable.js:986:34)
at resume_ (_stream_readable.js:967:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Judging from the underlying code, the problem seems to be that the library is expecting to receive the full response at once. However, with a high enough limit the response will be too big and will not be received in full by the first data event, causing the JSON parser to fail
To Reproduce
Steps to reproduce the behavior:
tenor.Search.Query
with a high limit (50 in my tests was more than high enough, happened with as low as 20)await tenor.Search.Query('meme', 50)
, as an exampleExpected behavior
Library should not break because the response is too large
Additional information
My config, for what it's worth:
const tenor = require("tenorjs").client({
Key: keys.tenor,
Filter: "off",
Locale: "en_US",
MediaFilter: "minimal",
DateFormat: 'YYYY-MM-DD - hh:mm:ss'
});
Hello dear creator!
I'm gonna ask you to help me with something I can't do.
My problem is: we pull the post from the results. media in post. I want to pull the gif to media but after "post.media" I can't pull the [objects] in it.
1-Tenor.Search.Random("anime hug", "1").then(Results => { Results.forEach(Post => {
2-var mediax = Post.media
okey we see console.log then see medias but
3- var gif = mediax.gif
finally wee saw error or undefined
i saw undefined.
Can you help me with how? Is there a mistake in me I wasn't sure?
An error will appear on an app's first run using TenorJS v1.0.6 with the following error message: Error: Cannot find module '../../tenor_config.json'
.
Describe the bug
TenorJS can not locate the configuration file it's supposed to create on its first run or when the client's configuration parameters (developer key, etc) have been modified.
To Reproduce
Steps to reproduce the behavior:
Error: Cannot find module '../../tenor_config.json'
.Expected behavior
TenorJS creates a configuration based on the configuration keys a user has set for the client (developer key, content and media filter level, etc), followed directly by the summoned function resolving as intended and returning whichever result the user expects (GIFs, trending terms, autocomplete, etc).
[email protected] has been deprecated, please use other http client.
Will this be fixed, or is TenorJS no longer maintained?
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.