RedGifs Downloader

Creates a sidebar button to download the currently playing gif in the currently selected quality.

< Отзив за RedGifs Downloader

Въпрос/коментар

§
Публикуван на: 05.06.2024
Редактиран на: 05.06.2024

Hey, it looks like they changed where they store the token, currently in localStorage with the key session_data, maybe you can update something like:

async function getGif(gifId) {
    // Check if the GIF information exists in the cache
    if (gifCache[gifId]) {
        return gifCache[gifId]; // Return cached data if available
    }
    const token = JSON.parse(localStorage.getItem('session_data')).token;

    // If not cached, fetch GIF info from the API
    let gifReq = await fetch(`https://api.redgifs.com/v2/gifs/${gifId}`, {
        method: 'GET',
        headers: {
            Authorization: `Bearer ${token}`,
        },
    });

    let gifInfo = await gifReq.json();

    // Cache the fetched GIF information
    gifCache[gifId] = gifInfo;

    return gifInfo;
}
hunkyburritoАвтор
§
Публикуван на: 05.06.2024

Thanks for the update. I've gone ahead and updated with the suggested changes.

Публикувайте отговор

Влезте, за да публикувате отговор.