#download all emotes as pngs

1 messages · Page 1 of 1 (latest)

opal forge
#

I need to make a custom tier list of ALL the 7tv emotes that we currently have on the channel. I was thinking of making it via tiermaker, so i would need all the emotes to be individual pngs or jpeg files. Is there a way to easily download the whole set into one of these formats?

mossy wedge
opal forge
sly ravine
#

you can use this gql request on the v3 gql api to get all the emotes in a set

query GetEmoteSet($id: ObjectID!, $formats: [ImageFormat!]) {
  emoteSet(id: $id) {
    id
    name
    emotes {
      name
      data {
        name
        host {
          url
          files(formats: $formats) {
            name
            format
            frame_count
          }
        }
      }
    }
  }
}
#

it'll return you a list of all the emotes in a format like this

opal forge
# sly ravine you can use this gql request on the v3 gql api to get all the emotes in a set `...

i wrote this but i'm accessing a wrong endpoint for the api I believe

import fetch from 'node-fetch';
import fs from 'fs';
import path from 'path';

const query = `
  query GetEmoteSet($id: ObjectID!, $formats: [ImageFormat!]) {
    emoteSet(id: $id) {
      id
      name
      emotes {
        name
        data {
          name
          host {
            url
            files(formats: $formats) {
              name
              format
              frame_count
            }
          }
        }
      }
    }
  }
`;

async function fetchEmoteSet(emoteSetId) {
    const response = await fetch('https://7tv.app/v3/gql', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            query: query,
            variables: { id: emoteSetId, formats: ['WEBP', 'PNG'] }
        })
    });

    const text = await response.text();  // Read the response as text first

    // Debugging: log the response to see what you received
    console.log('Response Text:', text);

    if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
    }

    try {
        const result = JSON.parse(text);  // Parse the text as JSON
        return result.data.emoteSet;
    } catch (error) {
        console.error('Failed to parse JSON:', error.message);
        throw new Error('Invalid JSON response');
    }
}

// other functions...
sly ravine
opal forge
#

ahhh there it is, now it works thank you!

sly ravine
#

👍

opal forge
#

do you believe there's a way of getting the animated ones as a gif or some other format?

sly ravine
#

yes

#

if its an animated emote

#

there's an automatically generated gif for it

#

under the same name but with .gif instead of .webp or .avif

#

so if you have this for example

#

you see the webp at the end

#

if you just change it to gif it'll be a gif

opal forge
#

ohhh that's great

sly ravine
#

yeah

opal forge
#

damn i wish i asked years ago

#

always had so many struggles with downloading emotes for reels and stuff

sly ravine
#

in the gql request i gave you, there's a framecount and if its bigger than 1 you can assume it's animated and add .gif at the end