How I transformed every news headline into a satire for April Fools
Using GPT-4 to write a Chrome extension that uses GPT-4 to modify website titles for no real reason
For April Fools Day, I decided that we all need a little more laughter in our lives…
So I made a Chrome extension that takes news headlines and converts them into the style of the Reductress. If you don’t know what the Reductress is, it’s one of my favorite places on the Internet. It’s a satirical women’s magazine with the mission to “take on the outdated perspectives and condescending tone of popular women’s media.”
For example, I can use the Chrome extension (which was both written by GPT-4) to rewrite an original NYT headline in a satirical tone (which was done by GPT-4). The original is on the left and the transformed version is on the right.
And the best part is that I did not write a single piece of code! Having never written a Chrome extension before, I was able to get this thing written and running in about 20 minutes.
A few of my favorite examples
This Chrome extension works on most websites! While my initial vision was just to take news articles about depressing or ridiculous subjects and make them funny, I realized soon that it works on most websites. Here is a collection of some of my favorite examples.
CNN: South Korea and glass ceilings
Bloomberg: Stocks
Honestly, maybe I should start calling stocks “Capitalism’s Daily Mood Swings” now.
Costco “New Items” Section
Recipes
What if every online recipe title was like this…
The controversial letter to pause AI experiments
The Chrome Web Store Help: getting meta with this article
For fun: Rethinking book titles
Full Circle! Back to the Reductress
Of course, I had to try the extension on the original Reductress website.
The Process
The process of making the Chrome extension was extremely simple. I didn’t look up a single documentation about Chrome extensions. I haven’t dealt with JavaScript code in over a year. I used GPT-4 through the ChatGPT interface.
When I had errors, I either described them in high level to GPT-4 or copied error messages, and it was able to handle all of them.
Tip 1: Start simple
I didn’t start by asking GPT-4 to write a Chrome extension that detects news headlines on a webpage, calls the OpenAI GPT API to rewrite it in a new style, then replace the original title with the new title. The more complicated the directions are, the more room for error to mess up.
Instead, I started by asking for something simpler. I asked GPT-4 to first write a Chrome extension to get the headline from a news site, to perform a simple transformation (capitalizing the original text), then replacing it.
GPT-4 gave me the code for 4 different files and 7 very detailed steps in what to put in each file and how to upload them to the Chrome extension page.
Tip 2: Describe problems and GPT-4 will try to solve them
At first, the Chrome extension wasn’t working. Even though I didn’t give much detail, it was able to update the code to fix the problem.
In fact, I even told ChatGPT to add logging to help and it knew exactly the right places to put logging and also how to view the logging.
Tip 3: Iteratively add functionality
Once I validated that the Chrome extension was working, I was able to modify the functionality. I copied the curl example from the OpenAI API webpage and GPT-4 knew exactly from which file to make the API request.
Tip 4: Copy entire error messages
I copied the error I saw and GPT-4 knew how to fix this. No time wasted in debugging!
And that’s it! Super simple to make. Go forth and make your own silly Chrome extension!
Blooper
Turns out that even this blog isn’t safe from the Chrome extension…