@opencraw/mcp 0.1.50 → 0.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -265,7 +265,7 @@ call their JSON endpoints: a report whose table the page reads from an API is re
265
265
 
266
266
  | Step | Fields | Notes |
267
267
  |---|---|---|
268
- | `request` | `url` (template), `method?`, `query?`, `headers?`, `body?` or `form?`, `as?` (`json`, `jsonl`, `html`, `text`, `pdf`, `csv`, `xlsx`, `pptx`, `yaml`, `markdown`, `xml`, `docx`), `encoding?`, `delimiter?`, `scalars?` | The response becomes the current document and, if `id` is set, the id holds the parsed JSON, the read PDF, workbook or deck, the markup or the text. Relative URLs resolve against the current page; one with no page to resolve against fails with a message saying so. Without `as`, the content type decides (`application/pdf` is a PDF, `text/csv` a CSV, a spreadsheet type a workbook, a presentation type a deck, `application/yaml` YAML, `application/x-ndjson` JSON Lines, `text/markdown` Markdown, an XML type XML: §4.12, a Word type a document read as HTML: §4.13); a type that says nothing (below) is sniffed. A `file:` URL reads a local file, its kind from `as`, else the extension (`.pdf`, `.csv`, `.tsv`, `.xlsx`, `.xlsm`, `.pptx`, `.yaml`, `.yml`, `.json`, `.jsonl`, `.ndjson`, `.md`, `.html`, `.xml`, `.rss`, `.atom`, `.xml.gz`, `.docx`), else its bytes; a relative one (`file:data/listino.csv`) is read from the recipe file's folder (below). 4xx/5xx fail the step. |
268
+ | `request` | `url` (template), `method?`, `query?`, `headers?`, `body?` or `form?`, `as?` (`json`, `jsonl`, `html`, `text`, `pdf`, `csv`, `xlsx`, `pptx`, `yaml`, `markdown`, `xml`, `docx`, `youtube`: §4.14), `encoding?`, `delimiter?`, `scalars?`, `youtube?` | The response becomes the current document and, if `id` is set, the id holds the parsed JSON, the read PDF, workbook or deck, the markup or the text. Relative URLs resolve against the current page; one with no page to resolve against fails with a message saying so. Without `as`, the content type decides (`application/pdf` is a PDF, `text/csv` a CSV, a spreadsheet type a workbook, a presentation type a deck, `application/yaml` YAML, `application/x-ndjson` JSON Lines, `text/markdown` Markdown, an XML type XML: §4.12, a Word type a document read as HTML: §4.13); a type that says nothing (below) is sniffed. A `file:` URL reads a local file, its kind from `as`, else the extension (`.pdf`, `.csv`, `.tsv`, `.xlsx`, `.xlsm`, `.pptx`, `.yaml`, `.yml`, `.json`, `.jsonl`, `.ndjson`, `.md`, `.html`, `.xml`, `.rss`, `.atom`, `.xml.gz`, `.docx`), else its bytes; a relative one (`file:data/listino.csv`) is read from the recipe file's folder (below). 4xx/5xx fail the step. |
269
269
 
270
270
  **A body served as anything** (`application/octet-stream`, `binary/octet-stream`, `text/plain`, `application/zip`
271
271
  and the like, or no content type: a file behind a bucket or a CDN, a download link, a raw file) is read by what it
@@ -941,7 +941,7 @@ matches a page whose markup has no `<tbody>`.
941
941
 
942
942
  ### 4.13 Word documents
943
943
 
944
- A `.docx` (a Word content type, `.docx`/`.docm`/`.dotx`, or `as: "docx"`) is read by `@opencraw/office-reader`
944
+ A `.docx` (a Word content type, `.docx`/`.docm`/`.dotx`, or `as: "docx"`; an OpenDocument `.odt` reads the same way) is read by `@opencraw/office-reader`
945
945
  and handed to the recipe as **HTML**, built like rendered Markdown (§4.10), so every tool for pages works on it:
946
946
 
947
947
  - headings (`Heading 1`, a localized `Titolo 2`, `Title`) become `<h1>`…`<h6>`, each in a
@@ -964,6 +964,42 @@ Its `id` holds the HTML, so `table` with `from: <id>` reads its tables after ano
964
964
  current document. Tracked changes read as accepted (insertions in, deletions out). A legacy `.doc` is refused with
965
965
  what to do: save it as `.docx`, or export it as PDF (§4.6). `probe` lists a document's sections and tables.
966
966
 
967
+ ### 4.14 YouTube videos
968
+
969
+ A `request` with `"as": "youtube"` to a video's address reads the **video**, not the page: what the page says about it, the caption tracks it has,
970
+ and a transcript with the time of every line. The result is JSON, so `jsonpath` reads it and every mapping and output works on it.
971
+
972
+ ```json
973
+ { "type": "request", "id": "video", "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw", "as": "youtube", "youtube": { "language": "en" } },
974
+ { "type": "extract", "id": "lines", "from": "video", "selector": "$.transcript.segments[*]", "kind": "jsonpath", "take": "json", "many": true },
975
+ { "type": "forEach", "over": "lines", "as": "line", "emit": true, "steps": [] }
976
+ ```
977
+
978
+ The address may be `watch?v=`, `youtu.be/`, `/shorts/`, `/embed/` or `/live/`. The document:
979
+
980
+ ```json
981
+ { "videoId": "jNQXAC9IVRw", "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw", "title": "Me at the zoo", "author": "jawed", "channelId": "UC4Q…",
982
+ "description": "…", "lengthSeconds": 19, "viewCount": 444571253, "keywords": ["me at the zoo"], "isLive": false, "thumbnail": "https://i.ytimg.com/…",
983
+ "captions": [{ "language": "en", "name": "English", "auto": false, "translatable": true }, { "language": "de", "name": "German", "auto": false, "translatable": true }],
984
+ "transcript": { "language": "en", "name": "English", "auto": false, "text": "All right, so here we are…\nthe cool thing…",
985
+ "segments": [{ "start": 1.2, "duration": 2.16, "text": "All right, so here we are, in front of the elephants" }] } }
986
+ ```
987
+
988
+ - `youtube.language` picks the transcript's language among the video's tracks: `pt-BR` exactly, or `pt` for any Portuguese track. Without it, the first
989
+ track the uploader wrote, else the first automatic one (`auto: true`, speech recognition: it makes mistakes).
990
+ - `youtube.translateTo` asks for a translation. When the video **has** a track in that language it is that track, the uploader's own words; the
991
+ transcript's `language` is then that language. YouTube's machine translation of a track into a language the video has no track for is **not**
992
+ available: YouTube asks for a token only a signed-in browser has, and the step fails saying so and listing the tracks the video does have.
993
+ - `youtube.transcript: false` reads only what is about the video (one request, no transcript).
994
+ - A video with no captions still reads: the document has `"captions": []` and no `transcript`, and a warning says so. A private, removed,
995
+ age-restricted or region-locked video fails the step with YouTube's own reason; so does a request YouTube turns away as automated (a captcha
996
+ page): wait and retry, or run from another network.
997
+ - Segments are the caption lines as YouTube cuts them (line breaks inside a line become spaces); `text` joins them with line breaks.
998
+
999
+ The requests go through the engine's own HTTP client, so `allowedHosts`, the proxy and the user agent rules apply (`www.youtube.com` must be allowed).
1000
+ This reads what YouTube shows anyone watching, as its own apps ask for it; respect the site's terms and do not collect at a rate its servers would
1001
+ take for abuse (`limits.delayMs` spaces the requests). In Studio, loading a YouTube address from **Load ▾** makes this recipe and shows the document as a tree.
1002
+
967
1003
  ## 5. Mapping
968
1004
 
969
1005
  ```json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencraw/mcp",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "type": "module",
5
5
  "main": "./dist/index.esm.js",
6
6
  "module": "./dist/index.esm.js",
@@ -25,8 +25,8 @@
25
25
  "!**/*.js.map"
26
26
  ],
27
27
  "dependencies": {
28
- "@opencraw/core": "^0.1.44",
29
- "@opencraw/cli": "^0.1.50",
28
+ "@opencraw/core": "^0.1.46",
29
+ "@opencraw/cli": "^0.1.52",
30
30
  "@modelcontextprotocol/sdk": "^1.32.1",
31
31
  "playwright": "^1.63.0",
32
32
  "zod": "^4.6.5"