Increasing the Entropy of the Universe with Puppeteer


I’m not a physicist – I’ve taken only three courses in it, moreso to satisfy my elective requirements than a passion for the field. So please excuse me if I butcher some of the technicalities, or if I’m just outright mistaken in my understanding of the topic. I suppose I’m approaching this more from a philosophical perspective than a mathematical one.

My (limited) understanding of entropy is that it can measure the amount of information in a system. The closer one gets to a disordered state (i.e, less information), the more entropy there is in the system.

My (limited) understanding of Puppeteer is that it can automate actions in web browsers, allowing website developers to perform quality assurance in the form of functional testing.

The title is perhaps a bit dramatic. Essentially, when I was 12 I joined an online forum for a certain indie game developer. I had many formative experiences on this website, being on it spurred me with creativity and inspired me to teach myself how to program games and mods, leading to my career today. However, there are many things about it which leave a bad taste in my mouth in the current day.

For one, who likes having records of the thoughts of their hyperactive 12/13/14 year old self preserved for all time? Another is the culture of the forum itself. The forum largely valued intelligence over all, including kindness. It was considered normal to write blistering critiques of not only each others creative work or projects, but your post style. It was not uncommon for members of the forum to deride one another for being “annoying” or “stupid”.

Of course, as a kid who wanted his work (and himself) to be respected, I quickly learned to play by the rules. I modeled my posting style after the more senior members of the forum. I wrote criticism of other people’s work that ventured into rudeness. The caustic attitude of the website was upheld and implicitly encouraged by the sarcastic forum admins.

I might be overstating things - in the end it was mostly just pre-teens and teenagers arguing over code style and video game maps. And I was a young, impressionable mind who wanted some validation in the online space since I definitely wasn’t receiving it IRL. I like to think now that I wouldn’t be so influenced by the forum culture and would instead treat others with kindness and respect, even if they made “bad posts”.

Anyway, with all that being said, I thought I would look into erasing some of my forum posts to give myself some peace of mind and move on from the forum for good. I have seen others use the term “infosuicide” to describe the act of purging online records, but I’m not sure if it’s very widespread. Since I had a good 1500 posts written primarily in the years 2012-2015, there was a lot of erasing to do, far more than I’d want to do by hand. So, I broke out Puppeteer to go through my post history page by page and replace all of my posts with a simple .... The script follows below:

const puppeteer = require('puppeteer');

function sleep(ms) {
  return new Promise((resolve) => {
    setTimeout(resolve, ms);
  });
}

const loginURL = "";
const username = "";
const password = "";
const topicBlackList = [];
const postListURL = "";
const editPostURL = "";

(async () => {
  const browser = await puppeteer.launch({headless: false});
  const page = await browser.newPage();
  await page.goto();
  await page.$eval('#username', el => el.value = username);
  await page.$eval('#password', el => el.value = password);
  await page.click('input[type="submit"]');

  await page.goto(postListURL);
  const urls = await page.evaluate(() => Array.from(document.querySelectorAll('.postbody h3 a')).map(el => el.href));
  for (let x = 0; x < urls.length; ++x) {
    const url = urls[x];
    const fRegex = /f=[0-9]+/;
    const pRegex = /p=[0-9]+/;
    const tRegex = /t=[0-9]+/;
    const fString = fRegex.exec(url)[0].substring(2);
    const pString = pRegex.exec(url)[0].substring(2);
    const tInt = parseInt(tRegex.exec(url)[0].substring(2));
    if (topicBlackList.filter(el => el == tInt).length > 0) {
      continue;
    }
    await page.goto(`${editPostUrl}&f=${fString}&p=${pString}`);
    const locked = (await page.content()).match(/locked/);
    if (locked) {
      continue;
    }
    await sleep(5000);
    await page.$eval('#message', el => el.value = '...');
    await Promise.all([
      page.click('input[name=post]'),
      page.waitForNavigation({waitUntil: 'networkidle2'})
    ]);
  }
  await browser.close();
})();

I’m pretty sure this increases the entropy of the universe? I would argue my series of … posts arguably contain less information than carefully thought out rants about the merits of a particular programming language. Either way, it makes for a good blog post title.

To some extent, I think my actions here speak to a larger trend among my fellow zoomers. We prefer more ephemeral social media where possible. Snapchat and the idea of the snapchat/instatagram “story” blossomed during my teenage years. Maybe all of the messaging our parents gave us about the permanence of the internet really sunk in. My generation didn’t want to stop using the internet, but we also didn’t want everything we posted remaining online forever. I guess in the end all we wanted was to have our informational self-determination flavoured cake and eat it too.