emoteJAM
emoteJAM copied to clipboard
[Research] Upload directly to BTTV
We need to research if it's even possible to have something like a button that uploads the final emote directly to BTTV.
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}`));
}
@Ciremun is there any convenient way for the user to get the token? Or does that require some hackerman skills with DevTools console?
I searched bttv issues page They say, they doesn't provide oauth or api documentation so yeah, being hackerman seems the only option now
@l4zygreed thank you for checking it out!