Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Research] Upload directly to BTTV #30

Open
rexim opened this issue May 3, 2021 · 4 comments
Open

[Research] Upload directly to BTTV #30

rexim opened this issue May 3, 2021 · 4 comments

Comments

@rexim
Copy link
Member

rexim commented May 3, 2021

We need to research if it's even possible to have something like a button that uploads the final emote directly to BTTV.

@Ciremun
Copy link
Contributor

Ciremun commented May 3, 2021

bad solution, but it could help
the user has to provide id and token

alert user id and token:

(function() {
    t = localStorage.getItem('USER_TOKEN').slice(1, -1);
    fetch('https://api.betterttv.net/3/account', {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            'authorization': `Bearer ${t}`
        }
    }).then(r => r.json()).then(j => j.id).then(i => prompt('', `${i} ${t}`));
})();

upload from emoteJAM:

function upload(user_id, token, data) {
    // data: {
    //     "code": <str - emote name>,
    //     "image: <str - base64 png or gif>,
    //     "justification": <str - approval notes>,
    //     "sharing": <bool>
    // }
    fetch(`https://api.betterttv.net/3/users/${user_id}/emotes`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'authorization': `Bearer ${token}`
        },
        body: JSON.stringify(data)
    }).then(r => console.log(`success: ${r.ok}`));
}

@rexim
Copy link
Member Author

rexim commented May 10, 2021

@Ciremun is there any convenient way for the user to get the token? Or does that require some hackerman skills with DevTools console?

@l4zygreed
Copy link

l4zygreed commented May 10, 2021

I searched bttv issues page
They say, they doesn't provide oauth or api documentation
so yeah, being hackerman seems the only option now

@rexim
Copy link
Member Author

rexim commented May 10, 2021

@l4zygreed thank you for checking it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants