Communitygithub.com

github-trending-video

Creates 9:16 vertical tech news videos from GitHub's weekly trending repos: data, assets, rendering in 1080×1920.

What is github-trending-video?

This skill automates the production of weekly 9:16 vertical videos (1080×1920) showcasing the top 13 GitHub trending repositories by star gain. It handles the entire pipeline: fetching data from GitHub Trending Today, structuring the video into 5 deep-dive plus 8 quick-look segments, scraping official website assets (scrolling screenshots or GitHub README images), writing 4-phase narration scripts, generating TTS and subtitles, and building the scene in HyperFrames for rendering. Key design decisions include a 4–5 minute runtime, strict single-source-of-truth for data (trending site for gains/growth, GitHub API for total stars), pre-scaled long screenshots to avoid rendering slowdowns, and a rolling window effect instead of screen recording. The skill supports cloud VM rendering (recommended) with tmux-based persistence and local fallback with low-memory mode workarounds. It includes built-in verification steps, preview utilities, and has been tested on real episodes (e.g., Bilibili BV1Efy5zNEcX).

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/13370463558/github-trending-video-skill/tree/HEAD

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Preview

From the skill README

github-trending-video preview

Documentation

GitHub Trending Video

Turn the "GitHub Weekly Trending Repos" into a 9:16 vertical tech news video: 1080×1920, Simplified Chinese, 4–5 minutes, 13 repos (5 deep-dives + 8 quick-looks).

Deliverables: final.mp4, subtitles.srt, reusable HyperFrames project.

When to Use

Use this skill when:

  • The user wants to produce an episode on "Top N fastest-growing projects" based on a weekly/monthly ranking.
  • The content is list-based, requiring each project to explain "what it is, how it works, and how to use it."
  • A repeatable weekly pipeline needs to be set up.

Pipeline

Fetch Ranking → Define Structure → Scrape Official Assets → Write Four-Phase Script → TTS + Subtitles → Build Scenes → Check → Render → Extract Frames for Validation

1. Fetch Ranking (Single Data Source)

Site: https://githubtrending.today/weekly/?sort=gained

Must complete "navigation + extraction + parsing" in the same browser call. The page is React. document.body.innerText may become an empty string between two CDP calls (due to re-rendering or losing focus).

goto_url(url); wait_for_load(); time.sleep(6)
raw = js("document.body.innerText")          # Fetch immediately, don't leave it for the next call
# Read collection time from the page, don't use local time
m = re.search(r'Collected ([A-Z][a-z]{2} \d+, \d{4}, \d{2}:\d{2} UTC)', raw)
# Each repo block starts with "Position", containing in order: rank / marker / owner~repo / description / #topic / Details / language / stars / "stars in total" / forks / "forks" / growth / gained
blocks = raw[raw.find("Position"):].split("Position")[1:]

Field specification:

FieldSourceDescription
gainedTrending siteWeekly new stars, only authoritative source
growth_pctTrending siteNone for new repos (no historical base), display —
totalGitHub APIExact stargazers_count value, don't use the trending site's 31.1k
forks/license/created/homepageGitHub APIhttps://api.github.com/repos/<owner>/<repo>

Pitfall: The trending site and GitHub API numbers can differ by hundreds (due to rounding and caching). Use gained/growth from the trending site, total from API, and annotate both sources on screen.

2. Define Structure: 5 Deep-Dives + 8 Quick-Looks

Making all 13 repos 30-second deep-dives would be both lengthy and shallow (repos 6–13 are mostly utility packages and can't support four-phase segments).

SegmentContentDuration
introEpisode number + data source8s
overviewFull list total + TOP5 list8s
repo-1..5Four-phase deep-dive34–43s each
roundup-aRepos 6–9, 4 cards20s
roundup-bRepos 10–13, 4 cards17s
summaryTOP5 + top five total15s
outroInteractive question8s

Total approximately 4:20. Word budget: 165–210 characters per deep-dive (3 beats), 25–30 characters per quick-look repo, 1300–1500 characters for the entire video.

3. Official Assets: Three Content Types, Three Approaches

Content TypeApproach
Lazy-loaded component (IntersectionObserver)Scroll screenshot per screen + stitch, pause 1.2s per screen
Real animation / GIF / videoScreenshot only captures one frame; record 3–5s mp4 for core selling points and embed <video>; take one frame for decorative elements
Decorative effects (gradient, hover)Ignore, static frame is fine

Page.captureScreenshot(captureBeyondViewport=true) does not trigger lazy loading outside the viewport, resulting in empty boxes. Must scroll screen by screen:

# 1) Scroll the entire page once to trigger
# 2) Hide fixed/sticky elements (otherwise navigation bar appears repeatedly on every screen)
js("[...document.querySelectorAll('*')].forEach(el=>{const cs=getComputedStyle(el);\n     if((cs.position==='fixed'||cs.position==='sticky') && el.getBoundingClientRect().height>40)\n       el.style.visibility='hidden';})")
# 3) Scroll each screen by vh, pause 1.25s, capture viewport, stitch into one long image

Dark mode:

  • Some sites have a toggle button (find a button with aria-label containing dark, click it before stitching)
  • If there's no dark mode (off-white background), accept it. Add a window border as a "product window" — the realism is a plus.
  • If dark components have low contrast (components same color as background), use PIL to increase brightness by ×1.9 and contrast by 1.12.

Long images must be pre-scaled to display width (window 840 → scale to 840 wide). Otherwise, each frame in the browser will need to scale a 1065×3722 image, tripling rendering time.

No Official Website: Screenshot GitHub README

Often half the repos in the ranking have an empty homepage. Use a three-level degradation; don't just place one data card if there's no website:

PrioritySourceApplication
1Product official websiteHas real UI, data, flow charts
2GitHub README rendered pageNo website, but README has screenshots/tables/architecture diagrams/command examples
3Plain text cardNeither exist, or README is all text

Key points for README screenshots:

  • First check if the README contains original images. If so, download directly from raw.githubusercontent.com — much clearer than screenshotting the rendered page.
  • If no images, screenshot the rendered page: https://github.com/<owner>/<repo>, target the article.markdown-body area.
  • GitHub supports dark mode: Emulation.setEmulatedMedia(prefers-color-scheme: dark) — better matches video style.
  • Scroll to bottom before screenshotting to trigger image lazy loading, then scroll back to README top.
  • Keeping the top of the repo page (repo name + star count) actually serves as evidence that "this is a real repo" — don't crop it out.
  • Follow the same "pre-scale to 840 wide" process after capturing.

For relative path images in README, convert to direct links:

import re
md = open(f"references/{owner}_{repo}.md").read()
for alt, src in re.findall(r'!\[([^\]]*)\]\(([^)]+)\)', md):
    if src.startswith("./"): src = src[2:]
    if not src.startswith("http"):
        src = f"https://raw.githubusercontent.com/{owner}/{repo}/HEAD/{src}"

references/github-readme-shots.md has the complete script and criteria for "when not to force a screenshot."

4. Scrolling Window: Long Screenshot + GSAP Pan, No Screen Recording

<div class="scroll-win"><img class="scroll-img" src="..." data-stops='[0,1058,2116]' /></div>
.scroll-win { width:840px; height:820px; overflow:hidden; border-radius:20px; }
.scroll-img { display:block; width:100%; height:auto; will-change:transform; }

Time allocation (beat duration bDur, number of stops n+1):

const rollT = 1.5;
const firstHold = Math.max(3.5, bDur * 0.28);   // First screen must be long enough
const holdT = Math.max(2.2, (bDur - firstHold - n * rollT) / n);

Two hard rules (both learned from user complaints):

  1. Don't use 4 stops. Splitting a 15s beat into 4 parts gives only 1.6s per screen — viewers can't even recognize "what product is this." 2 stops with 4s each is the minimum.
  2. First screen at least 3.5 seconds. Scrolling after 0.6s means nothing is seen clearly.

5. Script: 3 Beats Covering 4 Phases

BeatPhaseVisual
APosition + Pain PointTags / name / tagline / pain point block / data card
BMechanism + Hard SpecsScrolling window or mechanism card + four-column spec bars
COutcome + Target AudienceThree-step flow (with annotations) + install commands + footer

Word count: 55–75 characters per beat (approximately 13–15 seconds). Avoid words like "revolutionary" or "disruptive"; write concrete mechanisms and real numbers.

Subtitle cue splitting (split_cues):

  • First split sentences by 。!?;:, then by ,、
  • Maximum 22 characters per cue (36px font + 888px width, approximately 24 characters per line)
  • Merge very short cues (<8 characters) into adjacent ones
  • Setting the limit to 26 characters causes issues like a single 。 on its own line or English words being split

6. Scene Code: Single Data Source

Most important rule: The first three items in the spec bars must be calculated live from top-level fields. Never hardcode them.

const baseSpecs = [
  ["New This Week", "+" + fmt(repo.gained)],
  ["Total Stars", fmt(repo.total)],
  ["Growth", repo.growth_pct == null ? "—" : "+" + repo.growth_pct + "%"],
];
const extraSpecs = (repo.specs || [])
  .filter(([k]) => !/(New This Week|Total\s*Stars|Growth|Stars)/.test(k))
  .slice(0, 1);   // Spec bars are fixed at four columns

Once, hardcoding caused the card to show +7,248 / 30,882 while the total bar showed +7,240 / 31,138 — caught by a user.

Other defensive measures:

  • pct(n) returns — for null (new repos with no growth)
  • mediaCard(item) returns "" for null; repos without images don't render the .media-wrap class
  • Quick-look roundupScene(list, meta): 4 cards light up with stagger according to narration rhythm, step = max(2.2, (dur-3.5)/n)

Timeline rules:

  • Hard cuts between beats (tl.set(prev,{opacity:0,display:"none"})), no crossfades — overlapping two full-screen beats by 0.38s inevitably causes ghosting
  • Scene exits only fade out, don't move up (y:-66 would push titles out of the safe zone)
  • Key numbers display their final value directly, no scrolling — scrolling intermediate values can be misinterpreted as data errors

7. Rendering

Cloud VM (Recommended)

# Only package actually referenced assets (full tar is tens of MB, upload times out)
tar czf /tmp/deploy.tgz index.html src/ <project>/assets/audio/narration.wav <images referenced in data>

vm scp /tmp/deploy.tgz <render-vm>:/tmp/deploy.tgz
vm exec <render-vm> -- bash -lc 'cd ~/proj && tar xzf /tmp/deploy.tgz && hyperframes lint'

# Rendering must be in tmux: render monitors parent process; exec disconnection causes render_cancelled_parent_exited
tmux new-session -d -s render "cd ~/proj; { time hyperframes render \
  --quality high --workers 2 --no-low-memory-mode --output final.mp4; echo RC=\$?; } > /tmp/render.log 2>&1"

Reference values: 263 seconds / 7891 frames / 4 scrolling windows → 6–8 minutes output (4C8G, 2 workers).

Local Fallback (When Cloud VM Unavailable)

# ARM64: first fix browser path (npm upgrades can overwrite wrapper)
~/.hermes/skills/creative/hyperframes/scripts/fix-arm64-browser.sh

# First, render draft to validate timeline and visuals (about 1/3 the time of high)
hyperframes render --quality draft --workers 1 --no-low-memory-mode --output draft.mp4

# Then render high for final output; 2-core ARM64 takes about 25–40 minutes for 263s
hyperframes render --quality high --workers 1 --no-low-memory-mode --output final.mp4

Local limitations and workarounds:

  • When total RAM ≤ 8192MB, hyperframes forcibly enters low-memory mode: single worker and falls back to screenshots instead of beginframe; must add --no-low-memory-mode
  • Pure software rendering (SwiftShader), do not add --gpu
  • Long render sessions must use tmux/screen; parent process disconnection causes render_cancelled_parent_exited, which setsid nohup can't prevent
  • Segment fallback: use --start=0 --end=90, --start=90 --end=180 to output separately, then concat with ffmpeg; each segment is independently retryable
  • If CJK fonts are missing on the local machine, Chinese characters appear as boxes. Install Noto Sans CJK and add it to the font stack as a fallback.

8. Verification Checklist

  • hyperframes lint 0 error
  • hyperframes check --safe-zone=standard 0 error (read warnings one by one; line_unread usually means subtitle splits are too fine)
  • Spec bar numbers = total bar = narration (single data source)
  • Beat A subtitle top doesn't overlap data card bottom for each repo
  • Scrolling screenshots of official websites have no white borders or large blank areas
  • Extract frames from the final video: at least 1 frame per scene, check for blank/overlap/misalignment
  • index.html data-duration = actual duration of narration.wav

lint/check cannot catch visual issues. You must inspect the frames.

9. Preview: index.html Is Not for Human Viewing

main.js ends with tl.seek(0) — it stays on the first frame waiting for the renderer to seek. Opening index.html directly shows only a static image, and since html,body is fixed at 1080×1920, only the top-left corner is visible in a desktop window.

To show to people, add player.html: an iframe loading the composition with transform:scale(min(w/1080, h/1920)) + a bottom playback bar.

Audio synchronization: Use <audio> as the main clock. Only call tl.seek() when Math.abs(tl.time()-audio.currentTime) > 0.08. Don't seek every frame (which suppresses GSAP callbacks and stops number animations).

Pitfall: Under browser autoplay policies, code-based el.click() doesn't count as a user gesture, and audio.play() will be rejected. You need a real mouse/touch event (CDP Input.dispatchMouseEvent or manual user click).

10. Public Preview

cloudflared tunnel --url http://127.0.0.1:8090 uses QUIC, which is often blocked by corporate network UDP policies, resulting in precheck hard_fail=true. Add --protocol http2 to use HTTP/2 and connect successfully.

Redirect logs to a file before grepping for the URL. process poll only keeps the last few lines, so the https://xxx.trycloudflare.com URL in the banner may be truncated.

Alternative: ssh -L 8090:127.0.0.1:8090 user@host port forwarding, then open http://127.0.0.1:8090/player.html locally.

Examples

Related

  • creative/hyperframes — HyperFrames syntax, CLI, cloud rendering
  • references/asset-pipeline.md — Complete scripts for scraping and stitching official website assets
  • references/github-readme-shots.md — Scripts and criteria for screenshotting GitHub README when no official website exists
  • references/pitfalls.md — Detailed log of bugs encountered and fixes applied

Related Skills