Skip to content
Agentmart
Submit a tool

play-a-song-on-youtube

Play a requested song on YouTube via a browser tab and verify the watch-page <video> element is actually playing.

Skill by prakhar1114

IndexedMIT
Write a review

Chalk Labs

Need help deploying play-a-song-on-youtube?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/prakhar1114-play-a-song-on-youtube

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Play a requested song on YouTube via a browser tab and verify the watch-page <video> element is actually playing.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/play-a-song-on-youtube

What's inside

Skill name
play-a-song-on-youtube
Description
Play a requested song on YouTube via a browser tab and verify the watch-page <video> element is actually playing.
License
MIT
Instructions
119 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Agent Skills spec issues

  • files: referenced but missing: references/schema.json, references/optimized_plan.json

Files (8)

  • SKILL.md
  • inputs.example.json · inputs/
  • inputs.template.json · inputs/
  • fallback_plan.md · references/
  • learned_notes.md · references/
  • run.sh
  • play_song_on_youtube.py · scripts/
  • run.py · scripts/

SKILL.md (first lines)

# Play a song on YouTube (browser-harness)

Opens YouTube search results directly via `youtube.com/results?search_query=...`,
picks the top standard video result (skipping ads / Shorts / channel rows),
navigates to its canonical watch URL, and verifies the `<video>` element is
actively playing. Driven through `browser-harness` — no Spotlight, no Safari
address-bar typing, no UI clicks on YouTube itself.

## Inputs

JSON object passed via `--inputs-json /path/to/inputs.json`.

| Field        | Type   | Required | Description                                                |
|--------------|--------|----------|------------------------------------------------------------|
| `song_name`  | string | yes      | Search query entered into YouTube (song / video name).     |

- Template: [`inputs/inputs.template.json`](inputs/inputs.template.json)
- Example:  [`inputs/inputs.example.json`](inputs/inputs.example.json)

```json
{ "song_name": "numb linkin park" }
```

## Run

```bash
# default — uses inputs/inputs.example.json
./run.sh

# explicit inputs file
./run.sh /absolute/path/to/inputs.json
```

`run.sh` lives at the skill root and is a thin wrapper that reads `song_name`
from the inputs JSON, exports it as `SONG_NAME`, and invokes:

```bash
browser-harness -c "$(cat scripts/play_song_on_youtube.py)"
```

Behavior:

1. Opens a new browser tab at `https://www.youtube.com/results?search_query=<URL-encoded song_name>`
   and waits for the page to load. Skips Safari/Spotlight launch — the
   harness already has a controlled Chrome instance.
2. Polls the DOM (up to ~7.5s) for the first `ytd-video-renderer` link —
   this CSS selector intentionally excludes ad slots, Shorts shelves, and
   channel/playlist rows so the top *standard* video is selected.
3. Extracts the 11-char video id from the `?v=...` query param and
   navigates to the canonical `https://www.youtube.com/watch?v=<id>` URL.
   Using the canonical URL strips any `&list=RD...` autoplay-mix params
   that would otherwise hijack subsequent navigation.
4. Polls `document.querySelector("video")` for up to ~5s and confirms
   playback: `!paused && currentTime > 0 && readyState == 4`. If autoplay
   was blocked, calls `video.play()` and clicks `.ytp-play-button` once
   between polls before giving up.

## Outputs

Final state is printed to stdout by the script:

```
Top result video id: kXYiU_JCYtU
PLAYING: {'paused': False, 'currentTime': 5.6, 'readyState': 4}
{'url': 'https://www.youtube.com/watch?v=kXYiU_JCYtU', 'title': '... – Linkin Park - YouTube', ...}
playback_started=true
```

The final line is always `playback_started=true` or `playback_started=false`.

## Exit codes

| Code | Meaning                                                                |
|------|------------------------------------------------------------------------|
| `0`  | A YouTube watch page is open and the `<video>` element is playing.     |
| `1`  | No results found, no playable video, or playback did not start.        |

## Fallback

The optimized plan declares `fallback: ui_agent` for this step. If
`./run.sh` exits non-zero, hand off to the UI agent (or a human) rather
than retrying — repeating the same harness call will not change the
outcome. Likely causes: YouTube is showing a consent / sign-in interstitial,
the browser-harness Chrome isn't running, or the network is blocking
the site.

Step-by-step recovery instructions for driving YouTube's UI manually are
in [`references/fallback_plan.md`](references/fallback_plan.md).

## ask_llm decision points

None. Result selection is deterministic (first `ytd-video-renderer`), and
playback verification reads the live `<video>` element state — no
stochastic judgment required.

## Recovery notes

- **Top-result selector matters.** `ytd-video-renderer a#video-title` is
  the right selector. Don't relax it to `a#video-title` alone — that also
  matches Shorts and channel-upload rows, which either don't have a `?v=`
  param or jump into the Shorts player (which doesn't expose a standard
  `<video>` element the verification step can read).
- **Strip `&list=RD...`.** YouTube's "Mix - <song>" autoplay queue gets
  attached to the first result's href. Navigating to that URL works, but
  any later programmatic navigation gets pulled back into the mix.
  Re-navigating to the canonical `watch?v=<id>` avoids this entirely.
- **Autoplay can be blocked.** A fresh Chrome profile without prior user
  interaction sometimes refuses to autoplay with sound. The verification
  loop self-heals by calling `video.play()` and clicking the play button
  between polls.

## References

- [`references/schema.json`](references/schema.json) — byte-identical copy of workflow schema.
- [`references/optimized_plan.json`](references/optimized_plan.json) — byte-identical copy of optimized plan.
- [`references/learned_notes.md`](references/learned_notes.md) — notes captured during synthesis (selectors, traps, the canonical-URL trick).
- [`references/fallback_plan.md`](references/fallback_plan.md) — manual / UI-agent recovery path if `run.sh` fails.

From prakhar1114/ai_mime_marketplace, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Jun 17, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get play-a-song-on-youtube running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying play-a-song-on-youtube?

CallGet help
Cite this page

play-a-song-on-youtube skill. Agent Mart. https://agentmart.dev/skills/prakhar1114-play-a-song-on-youtube (last updated 2026-10-24)