Last active
          July 31, 2025 09:41 
        
      - 
      
- 
        Save tweinfeld/ca4433766e4eab499c96f0101f9f0a4f to your computer and use it in GitHub Desktop. 
    Archive all chats on "ChatGPT"'s Website
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const FIRST_CHAT_PATH = "div[1]/div/div[1]/div[1]/div/div[2]/nav/div[2]/aside/a[1]"; | |
| const MENU_PATH = "div[1]/div/div[1]/div[2]/main/div/div/header/div[3]/div/div/button"; | |
| const ARCHIVE_PATH = "div[4]/div"; | |
| const wait = (delay)=> new Promise((resolve)=> setTimeout(resolve, delay)); | |
| const xFind = (path)=> path.split("/").reduce((el, segment)=> { | |
| const [a,b,c,d] = [...segment.match(/^(\w+)(\[([0-9]+)\])?$/)]; | |
| return [...el.children].filter(({ tagName })=> tagName === b.toUpperCase())[+(d ?? "1") - 1]; | |
| }, document.body); | |
| ((f)=> f(f))(async function(self){ | |
| xFind(FIRST_CHAT_PATH).click(); | |
| await wait(1500), | |
| xFind(MENU_PATH).dispatchEvent(new PointerEvent("pointerdown", { bubbles: true })); | |
| await wait(100), | |
| [...xFind(ARCHIVE_PATH).children].find((el)=> el.textContent === "Archive").click() | |
| await wait(1000), | |
| self(self); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment