mirror of
https://github.com/only-cli/oc.git
synced 2026-09-15 10:40:56 +02:00
Watch pages need client JS to become interactive, but the title, description, view count, and caption tracks already ship inline in the initial HTML as ytInitialPlayerResponse, so this reads that directly instead of waiting on the v0.3 headless fallback. Each caption track becomes a numbered link, and oc do on it fetches the timedtext transcript, collapsed into one block so it pages through oc next/oc read like any other long document instead of costing one block per caption line. Adds youtubeToHTML and transcriptToHTML alongside feedToHTML in the distiller, a youtube.com.json shortcut, and offline tests against a fixture watch page. Fixes #6
13 lines
1.2 KiB
HTML
13 lines
1.2 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head><title>Rust for busy people: the borrow checker in five minutes - YouTube</title></head>
|
|
<body>
|
|
<div id="content">
|
|
<nav>skip to content</nav>
|
|
<div id="player-shell">loading player...</div>
|
|
</div>
|
|
<script nonce="abc123">var ytInitialPlayerResponse = {"videoDetails":{"videoId":"fixture123","title":"Rust for busy people: the borrow checker in five minutes","lengthSeconds":"312","channelId":"UCexampleChannelId000001","shortDescription":"A quick walkthrough of ownership and borrowing.\n\nTimestamps:\n0:00 intro\n1:20 ownership\n\n#rust #programming","viewCount":"128453","author":"Fixture Channel"},"microformat":{"playerMicroformatRenderer":{"publishDate":"2026-03-04","description":{"simpleText":"A quick walkthrough of ownership and borrowing."}}},"captions":{"playerCaptionsTracklistRenderer":{"captionTracks":[{"baseUrl":"https://www.youtube.com/api/timedtext?v=fixture123&lang=en","name":{"simpleText":"English"},"languageCode":"en","kind":"asr"},{"baseUrl":"https://www.youtube.com/api/timedtext?v=fixture123&lang=en&kind=manual","name":{"simpleText":"English"},"languageCode":"en"}]}}};</script>
|
|
<script nonce="abc123">var ytcfg = {"INNERTUBE_CONTEXT": {}};</script>
|
|
</body>
|
|
</html>
|