---
name: google-shared-content-extractor
description: Extract content from Google shared links (Gemini conversations, etc.) that are behind consent walls and JS-rendered SPAs. Covers consent bypass, cookie injection, DOM extraction, and document formatting.
---

# Google Shared Content Extractor

Extract and format content from Google shared links (Gemini conversations and similar Google SPAs) that are protected by consent walls and rendered via JavaScript.

## When to use

- User shares a `gemini.google.com/share/XXX` link and asks to extract/format the content
- Any Google SPA behind a consent wall (`consent.google.com`)
- Content is JS-rendered and not visible in raw HTML

## Workflow

### Step 1: Bypass the consent wall

**Option A — Direct POST to consent endpoint (preferred):**

```bash
curl -s -X POST "https://consent.google.com/save?continue=https://gemini.google.com/share/<ID>&gl=ES&m=0&pc=bard&x=5&src=2&hl=en-US&bl=boq_assistant-bard-web-server_20260511.16_p20&cm=2&set_eom=false&set_aps=true&set_sc=true" \
  -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d ""
```

This returns a `SOCS=` cookie (204 response).

**Option B — Extract consent URLs from HTML:**
Find them in `window.WIZ_global_data` or `<script id="bard-initial-data">` in the HTML source. Use `qw1mtf` for "accept all" and `acNycb` for "reject all" URLs.

**Option C — Browser console fetch + redirect (best for sequential navigation):**
When you need to extract from multiple URLs sequentially via the browser, use this from `browser_console`:

```javascript
fetch("https://consent.google.com/save?continue=https://gemini.google.com/share/<ID>&gl=ES&m=0&pc=bard&x=5&src=2&hl=en-US&bl=boq_assistant-bard-web-server_20260511.16_p20&cm=2&set_eom=false&set_aps=true&set_sc=true", {
  method: "POST",
  credentials: "include",
  headers: {"Content-Type": "application/x-www-form-urlencoded"}
}).then(r => {
  console.log("Consent saved, status:", r.status);
  window.location.href = "https://gemini.google.com/share/<ID>";
}).catch(e => console.error("Error:", e));
```

The `credentials: "include"` ensures the SOCS cookie sticks to the browser session automatically.

Google's `consent.google.com` redirect blocks automated access.

**Option A — Direct POST to consent endpoint (preferred):**

```bash
curl -s -X POST "https://consent.google.com/save?continue=https://gemini.google.com/share/<ID>&gl=ES&m=0&pc=bard&x=5&src=2&hl=en-US&bl=boq_assistant-bard-web-server_20260511.16_p20&cm=2&set_eom=false&set_aps=true&set_sc=true" \
  -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d ""
```

This returns a `SOCS=` cookie (204 response).

**Option B — Extract consent URLs from HTML:**
Find them in `window.WIZ_global_data` or `<script id="bard-initial-data">` in the HTML source. Use `qw1mtf` for "accept all" and `acNycb` for "reject all" URLs.

### Step 2: Inject cookie into browser

The browser tool also hits the consent wall. Set the cookie via `browser_console`:

```javascript
document.cookie = "SOCS=<VALUE>; domain=.google.com; path=/; Secure";
```

Then navigate to the shared URL again — the consent wall should be bypassed.

### Step 3: Extract JS-rendered content

**Method A — Full page snapshot (quick):**
`browser_snapshot(full=true)` — but watch for 8K char truncation.

**Method B — Console extraction (most reliable for long conversations):**
```javascript
// Get all visible text from main content area
const text = document.querySelector('main').innerText;
text;
```

For conversations over 50K chars, extract in chunks:
```javascript
// First 50K chars
document.querySelector('main').innerText.substring(0, 50000);
```
```javascript
// Next chunk
document.querySelector('main').innerText.substring(50000, 100000);
```

**Method C — Split by "Ваш запрос" markers (for Russian conversations):**
```javascript
// Get count of user queries
const parts = document.querySelector('main').innerText.split('Ваш запрос');
parts.length; // Number of query-response cycles
```

**Method D — Find new content after scrolling:**
For long conversations that extend beyond visible area, call `browser_scroll(direction="down")` first, then extract again.

Google Gemini shares are SPAs — content is rendered by JavaScript. Extract text from the DOM:

```javascript
// Get all visible text from main content area
const elements = document.querySelectorAll('main');
const result = [];
elements.forEach(el => {
  const text = el.innerText;
  if (text && text.length > 100) result.push(text);
});
result.join('\n\n===SEPARATOR===\n\n');
```

For very long conversations, extract via `browser_snapshot(full=true)` and scroll if needed.

### Step 4: Format as structured document

After extracting the raw conversation, structure it as one of these formats:

**Format A — Lightweight transcript (quick capture):**
```markdown
# [Conversation Title]

**Model:** [model name]
**Date:** [date]
**Source:** [URL]

## Transcript

### User:
...

### AI:
...
```

**Format B — Scientific/Analytical paper (deep analysis):**
```markdown
# [Title]

## Оглавление
...

## 1. Введение
Context, metadata, methodology note.

## 2. Основная часть — транскрипт
- Each query-response cycle numbered
- Citations preserved
- Key concepts **bolded**

## 3. Ключевые темы и концептуальный анализ
- Comparative tables
- Key metaphors (e.g. "Фонарик" model)
- Architecture diagrams
- Practical protocols

## 4. Заключение и выводы
5-7 synthesized findings

## 5. Библиография
Sources referenced in the conversation

## 6. Приложения
Additional related conversations

## 7. Analytical chapters (optional)
- Мнение автора (Hermes Agent's analysis)
- Главная критика (Main criticism — "Где всё ломается")
  - Epistemological closure
  - Metaphorical physics
  - Observer problem
  - Biologic materialism
  - Practical utility
  - Social isolation

## 8. Финальный аккорд
Closing reflection
```

For Russian-language philosophical/esoteric conversations (common with this user), include:
- A **comparative philosophy-science table**
- The **key metaphor** that ties all concepts together
- **Practical protocols** derived from the conversation
- A **main criticism chapter** that deliberately challenges the model

After extracting the raw conversation, structure it as:

1. **Title** — from the page heading
2. **Metadata** — model name, date created, date published
3. **Transcript** — each user query + model response as numbered sections
4. **Key themes** — analytical synthesis table
5. **Table of contents** — for navigation
6. **Conclusion** — summary of findings
7. **Bibliography** — sources referenced in the conversation

## Pitfalls

- **Cookies expire** — the SOCS cookie has an expiry date. For long sessions, re-acquire.
- **Consent URLs change** — the `bl` parameter (build label) in consent URLs changes with builds. Extract fresh from HTML.
- **Truncated content** — browser_snapshot truncates at ~8K chars. Use console expression with `substring(0, 50000)` to get more.
- **Different consent languages** — the consent page locale (hl=ru, hl=en-US) affects button text. Use `browser_vision` if the Russian/English selector confuses the snapshot.
- **Login wall** — some shared pages also show a "Sign in" button at top. The content is still publicly shared; the login is only for editing.

## Verification

- After extracting, check the first and last user queries are present
- Verify the model and date metadata matches what's on the page
- Confirm all numbered sections in the transcript are accounted for
