Skip to content

Commit c93a04c

Browse files
committed
fix: update ChatGPT selectors for section-based DOM (v1.0.3)
1 parent 3a65755 commit c93a04c

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
---
99

10+
## [1.0.3] – 2026-03-20
11+
12+
### Fixed
13+
14+
- **ChatGPT scraper not detecting messages** – ChatGPT changed their DOM from `<article>` to `<section>` elements for conversation turns. Updated selectors in both `chatgpt.js` and `overlay.js` (`SITE_CONFIG.msgSelector`) to match `section[data-testid^="conversation-turn-"]` with `article` fallback for backward compatibility.
15+
- **Overlay per-message buttons not visible on hover** – Added `section:hover .mde-msg-bar` CSS rule alongside the existing `article:hover` rule so export buttons appear on ChatGPT's new DOM structure.
16+
17+
---
18+
1019
## [1.0.2] – 2026-02-27
1120

1221
### Fixed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "MD-Export – AI Chat Exporter",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"description": "Export ChatGPT, Gemini, Grok, and Claude conversations as Markdown, DOCX, or PDF with full formatting preserved.",
66
"permissions": [
77
"activeTab",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "md-export",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Chrome extension to export AI chat conversations",
55
"scripts": {
66
"build": "webpack --mode production",

src/content/chatgpt.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/**
22
* chatgpt.js – ChatGPT conversation scraper
3-
* DOM: article[data-testid^="conversation-turn-"] with data-turn="user"|"assistant"
3+
* DOM: section[data-testid^="conversation-turn-"] (or article) with data-turn="user"|"assistant"
44
* User text: div.whitespace-pre-wrap
55
* Assistant: div.markdown.prose
66
*/
77

88
import { cleanHtml, htmlToMarkdown, getPageTitle } from './base_scraper.js';
99

1010
export function scrapeConversation() {
11+
// ChatGPT changed from <article> to <section> in mid-2025.
12+
// Match both for forward/backward compatibility.
1113
const articles = document.querySelectorAll(
12-
'article[data-testid^="conversation-turn-"]'
14+
'section[data-testid^="conversation-turn-"], article[data-testid^="conversation-turn-"]'
1315
);
1416

1517
if (!articles || articles.length === 0) {

src/content/overlay.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { cleanHtml, htmlToMarkdown } from './base_scraper.js';
2323
const SITE_CONFIG = {
2424
"chat.openai.com": {
2525
name: "ChatGPT",
26-
msgSelector: 'article[data-testid^="conversation-turn-"]',
26+
msgSelector: 'section[data-testid^="conversation-turn-"], article[data-testid^="conversation-turn-"]',
2727
roleAttr: "data-turn",
2828
contentSelector: {
2929
user: ".whitespace-pre-wrap",
@@ -33,7 +33,7 @@ import { cleanHtml, htmlToMarkdown } from './base_scraper.js';
3333
},
3434
"chatgpt.com": {
3535
name: "ChatGPT",
36-
msgSelector: 'article[data-testid^="conversation-turn-"]',
36+
msgSelector: 'section[data-testid^="conversation-turn-"], article[data-testid^="conversation-turn-"]',
3737
roleAttr: "data-turn",
3838
contentSelector: {
3939
user: ".whitespace-pre-wrap",
@@ -146,6 +146,7 @@ import { cleanHtml, htmlToMarkdown } from './base_scraper.js';
146146
transition: opacity 0.2s;
147147
}
148148
article:hover .mde-msg-bar,
149+
section:hover .mde-msg-bar,
149150
[data-testid]:hover .mde-msg-bar,
150151
div.conversation-container:hover .mde-msg-bar {
151152
opacity: 1;

0 commit comments

Comments
 (0)