GithubHelp home page GithubHelp logo

jinzulen / tenorjs Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 7.0 97 KB

Feature-rich client for Tenor.

License: Apache License 2.0

JavaScript 100.00%
tenor gif mp4 webm wrapper api bots discord nanogif nanomp4

tenorjs's People

Contributors

jinzulen avatar rianfuro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tenorjs's Issues

Unable to visualize GIFs

Description
The GIF does not load when it's requested. (Using DiscordJS)

To Reproduce
Steps to reproduce the behavior:

  1. Import TenorJS
  2. Make a random search
  3. Add the link to the Discord Embed (For example)
  4. Call the embed on Discord
    Expected behavior
    The GIF should be shown on Discord in the embed

Actually, the GIF does not load.
Screenshots
image
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);
            });
        }

SyntaxError: Unexpected end of JSON input

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.

Screenshots
image

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.

Exception when fetching too much data

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:

  1. Call 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 example

Expected 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'
});

how to find Post.media.gif ?

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?

Screenshots
Adsız
Adsız2

TenorJS can't find the configuration file.

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:

  1. Upgrade to TenorJS v1.0.6/Download TenorJS v1.0.6.
  2. Configure the client by setting the necessary configuration parameters (developer key, etc).
  3. Call any function whatsoever (Trending terms, GIFs by IDs, etc) and run the app.
  4. App crashs with the message 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).

Tenor gives me no gifs. Just a poop image instead

errortenor
everything's alright. No error no nothing at all. but when I embed this tenor API gifs. It shows me this instead of choosing a random gif and giving it to me. Someone solve it
am getting this type of error when i used the tenor api. Is there any fix? please tell me. I am in need of this..please

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.