// ==UserScript== // @name NationStates Auto-Poster // @namespace https://forum.nationstates.net/ // @version 1.1 // @description Periodically posts to a forum thread, auto-refreshing tokens // @author You // @match https://forum.nationstates.net/posting.php?mode=post&f=23 // @grant none // ==/UserScript== (() => { 'use strict'; // Configuration const config = { subject: 'SOYJAK.ST', message: [ 'Kill niggers. Behead niggers. Roundhouse kick a nigger into the concrete. Slam dunk a nigger baby into the trashcan. Crucify filthy blacks. Defecate in a niggers food. Launch niggers into the sun. Stir fry niggers in a wok. Toss niggers into active volcanoes. Urinate into a niggers gas tank. Judo throw niggers into a wood chipper. Twist niggers heads off. Report niggers to the IRS. Karate chop niggers in half. Curb stomp pregnant black niggers. Trap niggers in quicksand. Crush niggers in the trash compactor. Liquefy niggers in a vat of acid. Eat niggers. Dissect niggers. Exterminate niggers in the gas chamber. Stomp nigger skulls with steel toed boots. Cremate niggers in the oven. Lobotomize niggers. Mandatory abortions for niggers. Grind nigger fetuses in the garbage disposal. Drown niggers in fried chicken grease. Vaporize niggers with a ray gun. Kick old niggers down the stairs. Feed niggers to alligators. Slice niggers with a katana.', 'SOYJAK.ST', 'NOTHING IS BEYOND OUR REACH' ].join('\n'), intervalMs: 1000, // 1 second forumUrl: 'https://forum.nationstates.net/posting.php?mode=post&f=23' }; /** * Fetch the posting page and extract all hidden inputs into an object */ async function fetchFormFields() { const res = await fetch(config.forumUrl, { credentials: 'include' }); if (!res.ok) throw new Error(`Failed to fetch form: ${res.status}`); const html = await res.text(); // Parse hidden inputs via DOMParser const parser = new DOMParser(); const doc = parser.parseFromString(html, 'text/html'); const inputs = doc.querySelectorAll('form[name=post] input[type=hidden]'); const fields = {}; inputs.forEach(input => { fields[input.name] = input.value; }); return fields; } /** * Send the post using the latest form fields */ async function sendPost() { try { // 1. Grab dynamic hidden form values (tokens, timestamps, etc.) const hidden = await fetchFormFields(); // 2. Build the payload const payload = new URLSearchParams({ ...hidden, subject: config.subject, message: config.message, addbbcode20: '100', attach_sig: 'on' }); // 3. POST to the forum const res = await fetch(config.forumUrl, { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': config.forumUrl, 'User-Agent': navigator.userAgent }, body: payload.toString() }); if (!res.ok) { console.error(`Post failed (status ${res.status})`); } else { console.log(`Posted successfully at ${new Date().toLocaleTimeString()}`); } } catch (err) { console.error('Error sending post:', err); } } // Start the loop setInterval(sendPost, config.intervalMs); // Optionally run immediately: sendPost(); })();