Skip to content

Instantly share code, notes, and snippets.

@oliverswitzer
Created February 27, 2023 15:05
Show Gist options
  • Save oliverswitzer/b96265539c4760cbd5a873bd3cc2fde4 to your computer and use it in GitHub Desktop.
Save oliverswitzer/b96265539c4760cbd5a873bd3cc2fde4 to your computer and use it in GitHub Desktop.
ChatGPT Browser Script: Use this to programmatically ask ChatGPT questions
SCRIPT TO TALK TO GPT3
const prompt = "why am I getting this error" // change me
let button = document.querySelectorAll("button")[5];
let textarea = document.querySelector("textarea");
textarea.innerText = prompt;
button.dispatchEvent(new Event("click", {bubbles: true}))
const getResults = () => [...document.querySelectorAll('.markdown.prose')]
const printLastResult = () => {
const results = getResults()
console.log(results[results.length - 1].innerText)
}
const printInterval = setInterval(() => printLastResult(), 1000)
setTimeout(() => clearInterval(printInterval), 15000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment