Oddbean new post about | logout
 If you are curious, the code is: javascript:(function() { const apiKey = '[[your api key goes here ]]'; function cleanContent(element) { const clone = element.cloneNode(true); clone.querySelectorAll('img').forEach(img => { const placeholder = document.createTextNode('[image]'); img.parentNode.replaceChild(placeholder, img); }); clone.querySelectorAll('a').forEach(link => { const urlText = document.createTextNode(link.href); link.parentNode.replaceChild(urlText, link); }); return clone.textContent .trim() .replace(/\s+/g, ' '); } var styleSheet = document.createElement('style'); styleSheet.textContent = '.classify-lowEffort {border-right: solid 1em red} .classify-technical {border-right: solid 1em blue} .classify-deepThought {border-right: solid 1em green} .classify-social {border-right: solid 1em white}'; document.head.appendChild(styleSheet); document.querySelectorAll('.css-1830czf').forEach(async (div, x) => { const span = div.querySelector('.chakra-text'); if (span) { const content = cleanContent(span); try { const response = await fetch('https://api.ppq.ai/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` }, body: JSON.stringify({"model":"gpt-4o-mini","messages":[{"role":"user","content":`Classsify the following post on social media as one of trivia, technical, social, lowEffort or deepThought. Answer with just the case sensitive classification: ${content}`}]}) }); if (response.ok) { const responseData = await response.json(); const x = responseData.choices[0].message.content; div.classList.add(`classify-${x}`); } } catch (error) { console.error('Error:', error); } } }); })()

Just store it as a bookmark's link and get an apiKey from https://ppq.ai/

To get an idea of how good it works, the color codes are lowEffort red, technical blue, deepThought green and social white.

There is a bug by which it only considers text up to a link or image I think. cleanContent() was put in to improve this but it doesn't work yet.