Skip to content

BiscuitCoder/console_del_xgrok_chats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Grok Chat Batch Deletion Script

A browser console script to batch delete Grok chat conversations on X (Twitter).

Why This Project Exists

X's Grok does not provide a batch deletion feature for chat history. Deleting conversations one by one becomes tedious when you have many. This script automates the process through the browser console.

Safety: All operations run locally in your browser. No data is sent to third-party servers.

Quick Start

Prerequisite: Open the chat history popup/dialog in Grok first.

  1. Copy the entire code from console_del_xgrok_chats.js to your browser console
  2. Open DevTools → Network tab, find any request to https://x.com/i/api/
  3. Copy the authorization header value (starts with Bearer )
  4. Call: deleteGrokChats('Bearer your-authorization-token')

Get Authorization Token: In Network tab → Click any x.com/i/api/ request → Headers → Copy authorization value

Custom Class: If default class doesn't match, use: deleteGrokChats(auth, 'your-classname')

QueryId: The script auto-detects queryId. If deletion fails, manually get it:

  1. Delete a conversation manually in Grok
  2. In Network tab, find the request URL: /graphql/QUERY_ID/ConversationItem_DeleteConversationMutation
  3. Use: deleteGrokChats(auth, classname, 'QUERY_ID')

Default class: css-175oi2r r-13awgt0 r-pm9dpa r-bnwqim r-13qz1uu

Example

deleteGrokChats('Bearer your-authorization-token', 'your-queryId', 'your-classname')

Troubleshooting

  • "Element not found": Make sure chat history popup is open
  • "Cannot get CSRF token": Ensure you're logged in and refresh the page
  • "No conversation IDs found": Verify popup is open and contains conversations
  • Deletion fails: QueryId might be different. Get it from Network tab and pass as third parameter

License

MIT License


Grok 聊天记录批量删除脚本

用于在 X (Twitter) 上批量删除 Grok 聊天记录的浏览器控制台脚本。

项目起因

X 的 Grok 没有提供批量删除聊天记录的功能。当聊天记录很多时,一个个删除非常繁琐。这个脚本通过浏览器控制台自动化删除过程。

安全性:所有操作都在本地浏览器运行,不会向第三方服务器发送任何数据。

快速开始

前提条件:必须先打开 Grok 的聊天历史弹窗。

  1. 复制 console_del_xgrok_chats.js 中的整个代码到浏览器控制台
  2. 打开开发者工具 → Network 标签,找到任意 https://x.com/i/api/ 开头的请求
  3. 复制请求头中的 authorization 值(以 Bearer 开头)
  4. 调用:deleteGrokChats('Bearer your-authorization-token')

获取 Authorization Token:Network 标签 → 点击任意 x.com/i/api/ 请求 → Headers → 复制 authorization

自定义 Class:如果默认 class 不匹配,使用:deleteGrokChats(auth, 'your-classname')

QueryId:脚本会自动检测 queryId。如果删除失败,可手动获取:

  1. 在 Grok 中手动删除一个对话
  2. 在 Network 标签中找到请求 URL:/graphql/QUERY_ID/ConversationItem_DeleteConversationMutation
  3. 使用:deleteGrokChats(auth, classname, 'QUERY_ID')

默认 class:css-175oi2r r-13awgt0 r-pm9dpa r-bnwqim r-13qz1uu

示例

deleteGrokChats('Bearer your-authorization-token', 'your-queryId', 'your-classname')

故障排除

  • "找不到元素":确保已打开聊天历史弹窗
  • "无法获取 CSRF token":确保已登录并刷新页面
  • "未找到 conversation ID":确认弹窗已打开且包含聊天记录
  • 删除失败:queryId 可能不同,从 Network 标签获取并作为第三个参数传入

许可证

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors