Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@boisei0
Created December 4, 2018 03:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boisei0/bb5ca245be0bcb4af89ea872a0a227b8 to your computer and use it in GitHub Desktop.
Save boisei0/bb5ca245be0bcb4af89ea872a0a227b8 to your computer and use it in GitHub Desktop.
Tampermonkey script to view flagging scores on a user's latest posts on tumbr. Usage: be logged in and go to dashboard. Type the blog name of the user you want to see in the search bar (yes very original I know 😂) and click the "check flagging scores" button. The output gets printed to your javascript console.
// ==UserScript==
// @name Tumblr score checker
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Will test posts and displays the scores for NSFW/explicit content and if they got flagged
// @author You
// @match https://www.tumblr.com/dashboard
// @grant GM_xmlhttpRequest
// @connect tumblr.com
// ==/UserScript==
(function() {
'use strict';
// Get form key from page DOM
let form_key = document.getElementById('tumblr_form_key').getAttribute('content');
function getFlagScores() {
let blog_name = document.getElementById('search_query').value || 'flight-of-the-felix';
GM_xmlhttpRequest({
method: 'GET',
url: `https://www.tumblr.com/svc/indash_blog?tumblelog_name_or_id=${blog_name}&post_id=&limit=10&offset=0&should_bypass_safemode=true&should_bypass_tagfiltering=true`,
headers: {
'X-tumblr-form-key': form_key,
'X-requested-with': 'XMLHttpRequest',
'Referer': `https://www.tumblr.com/dashboard/blog/${blog_name}`
},
responseType: 'json',
onload: function(data) {
data.response.response.posts.forEach(post => {
console.log(post.type);
console.log(post.is_nsfw_based_on_score);
console.log(post.is_nsfw);
console.log(post.classification);
console.log(post.nsfw_score);
console.log(post.post_url);
console.log(post.summary);
console.log('');
});
}
});
}
let flagButton = document.createElement('button');
flagButton.appendChild(document.createTextNode('Check flagging scores'));
flagButton.id = 'flagScoreButton';
flagButton.classList.add('tab', 'iconic');
flagButton.addEventListener('click', getFlagScores);
let parent = document.getElementById('user_tools');
parent.insertBefore(flagButton, parent.firstChild.nextSibling);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment