Skip to content

Commit c745432

Browse files
authored
Fix: Extracting from the new Claude interface (#293)
* fix: extracting Claude artifact content * fix: close Claude artifact * fix: getting inputs list and titles * fix: catching artifact names * 3.8.11
1 parent dd633d6 commit c745432

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "save-my-chatbot",
3-
"version": "3.8.10",
3+
"version": "3.8.11",
44
"license": "RMD-C 1.1",
55
"author": "Hugo COLLIN",
66
"homepage": "https://save.hugocollin.com",

public/files/updateNotes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Update notes
22
# 3.8.10
3-
🧩 Fixing Perplexity Pages export
4-
Some quirky things under the hood but Perplexity Pages export is now working again!
3+
🧩 Fixing Perplexity Pages and Claude export
4+
Claude changed its interface again, but we're back on track!
5+
Plus, Perplexity Pages export is now working again!
56

67
# 3.8.9
78
🧩 Fixing Perplexity and Claude export

src/core/services/pageExtractor/defineAction.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import {sleep} from "../../utils/jsShorteners";
55
//TODO: currently for Claude artifacts, needs to be generalized
66
async function clickActClose(markdown: string | undefined, format: ((html: string) => string) | undefined, extractionTypeId: string, btns?: NodeListOf<any>) {
77
// selector duplication with processMessage in ClaudeChat.js and contentSelector in ClaudeChat.json
8-
const pane = document.querySelector("div.fixed.flex");
8+
const pane = document.querySelector("body div.h-full.overflow-hidden.flex-1");
99

1010
for (const artifactBtn of btns?.values() ?? []) {
11-
const artifactName = artifactBtn.querySelector(".break-all")?.textContent
11+
const artifactName = artifactBtn.querySelector(".shrink.flex, .leading-tight")?.textContent
1212
// console.log(artifactName)
1313
// @ts-ignore
1414
artifactBtn.click();
@@ -43,7 +43,7 @@ async function clickActClose(markdown: string | undefined, format: ((html: strin
4343
}
4444

4545
// @ts-ignore
46-
pane?.querySelector(".justify-end > button")?.click(); // close artifact
46+
pane?.querySelector(`.text-sm.items-center.gap-2.flex > .active\\:scale-95.rounded-md.w-8.h-8.aria-expanded\\:text-text-100.aria-checked\\:text-text-100.aria-pressed\\:text-text-100.hover\\:text-text-100.aria-expanded\\:bg-bg-300.aria-checked\\:bg-bg-400.aria-pressed\\:bg-bg-400.hover\\:bg-bg-400.ease-\\[cubic-bezier\\(0\\.165\\,0\\.85\\,0\\.45\\,1\\)\\].duration-300.font-styrene.transition.border-transparent.text-text-300.disabled\\:drop-shadow-none.disabled\\:shadow-none.disabled\\:opacity-50.disabled\\:pointer-events-none.select-none.can-focus.shrink-0.relative.justify-center.items-center.inline-flex`)?.click(); // close artifact
4747

4848
return markdown;
4949
}
@@ -58,7 +58,7 @@ export async function defineAction(action: {
5858
return clickElements(action.selector);
5959
case "click_act_close":
6060
let md = await clickActClose(markdown, format, `CAPTURE_ARTIFACT_CONTENT`, document.querySelectorAll('.font-claude-message button[aria-label]'));
61-
md = await clickActClose(md, format, "CAPTURE_INPUT_CONTENT", document.querySelectorAll('[data-test-render-count] button[data-testid]'));
61+
md = await clickActClose(md, format, "CAPTURE_INPUT_CONTENT", document.querySelectorAll('[data-testid=\"file-thumbnail\"]'));
6262
return md;
6363
// case "scroll":
6464
// return scrollElements;

src/features/scraper/domains/ClaudeChat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {capitalizeFirst} from "../../../core/services/format/formatText";
22

33
export async function processMessage(content, format, metadata) {
44
const messageSelector = content.querySelector("[data-testid=\"user-message\"], [data-is-streaming] > div");
5-
const inputsSelector = content.querySelectorAll("button[data-testid]");
5+
const inputsSelector = content.querySelectorAll('[data-testid=\"file-thumbnail\"]');
66

77
const entityName = content?.querySelector("[data-is-streaming]")
88
? "Claude"
@@ -12,7 +12,7 @@ export async function processMessage(content, format, metadata) {
1212

1313
let inputsText = "##### Content:\n";
1414
inputsText += Array.from(inputsSelector).map((input) => {
15-
const text = input?.querySelector(".break-words")?.textContent ?? "Input";
15+
const text = input?.querySelector(".shrink.flex")?.textContent ?? "Input";
1616
return `{{@CAPTURE_INPUT_CONTENT:${text}}}`;
1717
}).join("\n");
1818

src/features/scraper/rules/rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export function filter_captureArtifactContent_Claude(node: Element) {
249249
}
250250

251251
export function replacement_captureArtifactContent_Claude(content: any, node: Element) {
252-
return `{{@CAPTURE_ARTIFACT_CONTENT:${node.querySelector(".break-all")?.textContent}}}`;
252+
return `{{@CAPTURE_ARTIFACT_CONTENT:${node.querySelector(".leading-tight")?.textContent}}}`;
253253
}
254254

255255

0 commit comments

Comments
 (0)