← 返回 Skills 市场
esanle

Beatport Download via Browser Tool

作者 esanle · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
56
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install beatport-dl-with-browser-tool
功能描述
Download purchased tracks from Beatport using the openclaw headless browser tool (CDP). Handles login, authentication via NextAuth, enabling downloads in hea...
使用说明 (SKILL.md)

Beatport Download via Browser Tool

Download purchased Beatport tracks through the openclaw headless browser using CDP (Chrome DevTools Protocol).

Prerequisites

  • openclaw browser running on 127.0.0.1:9222
  • Beatport credentials (username + password)
  • ws module at /opt/homebrew/lib/node_modules/openclaw/node_modules/ws
  • Node.js runtime

Authentication Flow

Beatport uses a dual-auth system:

  1. account.beatport.com — Django session (sessionid cookie)
  2. www.beatport.com — NextAuth (__Secure-next-auth.session-token cookie)

Login Steps

  1. Navigate to https://account.beatport.com/ via CDP Page.navigate
  2. Fill username/password via Runtime.evaluate (use native input setters to bypass React controlled inputs)
  3. Submit the login form
  4. On the www.beatport.com tab, sign in via NextAuth:
// In browser context on www.beatport.com
fetch("/api/auth/csrf").then(r => r.json()).then(csrf => {
  const fd = new URLSearchParams();
  fd.append("csrfToken", csrf.csrfToken);
  fd.append("username", "USER");
  fd.append("password", "PASS");
  fd.append("callbackUrl", "https://www.beatport.com/");
  // Create hidden form and submit (fetch redirect fails cross-origin)
  const form = document.createElement("form");
  form.method = "POST";
  form.action = "/api/auth/signin/beatport";
  form.style.display = "none";
  for (const [k, v] of Object.entries(Object.fromEntries(fd))) {
    const inp = document.createElement("input");
    inp.type = "hidden"; inp.name = k; inp.value = v;
    form.appendChild(inp);
  }
  document.body.appendChild(form);
  form.submit();
});
  1. Verify login: Account menu button should appear in navbar (no Create Account or Log In button)

Key URLs

Page URL Purpose
Cart https://www.beatport.com/cart Items pending purchase
Library https://www.beatport.com/library Purchased tracks (may show Upgrade for free accounts)
Downloads https://www.beatport.com/library/downloads Download queue
Checkout https://www.beatport.com/checkout Payment page

Note: /my-beatport/downloads and /my-beatport/collection return 404. The correct paths are /library and /library/downloads.

Enabling Downloads in Headless Chrome

Headless Chrome cancels downloads by default. Enable via CDP on the browser-level WebSocket:

// Browser-level WS: ws://127.0.0.1:9222/devtools/browser/\x3Cid>
ws.send(JSON.stringify({
  id: 1,
  method: "Browser.setDownloadBehavior",
  params: {
    behavior: "allowAndName",
    downloadPath: "/path/to/download/dir/",
    eventsEnabled: true
  }
}));

Get browser ID from http://127.0.0.1:9222/json/versionwebSocketDebuggerUrl.

Downloading Tracks

Step 1: Add tracks to download queue

On /library, each track has a re-download icon (svg[data-testid='icon-re-download']). Click each one to add to the download queue:

var icons = document.querySelectorAll("svg[data-testid='icon-re-download']");
icons.forEach(function(icon, i) {
  setTimeout(function() { icon.closest("button, div").click(); }, i * 500);
});

Step 2: Download from queue page

Navigate to /library/downloads. All queued tracks appear with a "Download All" button.

Step 3: Click Download All

Enable browser downloads first (see above), then click:

var btn = [...document.querySelectorAll("button")].find(b => b.innerText.includes("Download All"));
if (btn) btn.click();

The download arrives as a zip file (e.g. beatport_tracks_2026-04.zip).

Step 4: Unzip and clean up

cd /path/to/download/dir
unzip -o beatport_tracks_*.zip -d tmp/
mv tmp/*.mp3 .
rm -rf tmp/ beatport_tracks_*.zip

Download URL Format

https://zips.beatport.com/v1/download?token=\x3CJWT_TOKEN>

The token is single-use and expires quickly. Always capture fresh from events.

Download URL Format

https://zips.beatport.com/v1/download?token=\x3CJWT_TOKEN>

The token is single-use and expires quickly. Always capture it fresh from the Page.downloadWillBegin event.

API Access

Access Token

curl -s -H "Cookie: \x3Ccookies>" \
  "https://www.beatport.com/_next/data/\x3CbuildId>/en/library/downloads.json" \
  | jq -r '.pageProps.accessToken'

Library Data

curl -s -H "Cookie: \x3Ccookies>" \
  "https://www.beatport.com/_next/data/\x3CbuildId>/en/library.json" \
  | jq '.pageProps.dehydratedState.queries[].state.data.results[] | {name, id, artists}'

Build ID

curl -s "https://www.beatport.com/" | grep -o '"buildId":"[^"]*"' | head -1

Current buildId (subject to change): PWoDyRo_P5V8lNYu_92bX

Common Pitfalls

  1. Cross-domain navigation fails with Page.navigate — Use location.href = "..." via Runtime.evaluate instead
  2. React controlled inputs don't respond to .value = — Use native input value setter:
    var input = document.querySelector("input[name=username]");
    var nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set;
    nativeSetter.call(input, "username");
    input.dispatchEvent(new Event("input", { bubbles: true }));
    
  3. Node.js string escaping in -e — Use String.raw\...`template literals, or write code to a file and run withnode file.js`
  4. Free account download limit — 20 downloads per track. "Unlimited re-downloads" requires Beatport Streaming subscription
  5. CDP exec timeout — openclaw kills long-running node processes (~10s). Keep CDP operations short; use background: true + process poll for longer waits
  6. curl path — Use /usr/bin/curl, not /opt/homebrew/bin/curl (may not exist)

CDP Helper Pattern

Write scripts to files to avoid shell escaping issues:

// scripts/beatport-cdp.js
const WS = require("/opt/homebrew/lib/node_modules/openclaw/node_modules/ws");
const http = require("http");

function getPage(filter) {
  return new Promise((resolve) => {
    http.get("http://127.0.0.1:9222/json", (res) => {
      let body = "";
      res.on("data", (c) => body += c);
      res.on("end", () => {
        const pages = JSON.parse(body).filter(p => p.type === "page");
        resolve(filter ? pages.find(filter) || pages[0] : pages[0]);
      });
    });
  });
}

function cdpEval(ws, expression) {
  return new Promise((resolve) => {
    ws.send(JSON.stringify({ id: Date.now(), method: "Runtime.evaluate", params: { expression, returnByValue: true } }));
    ws.on("message", (m) => {
      const d = JSON.parse(m.toString());
      if (d.id && d.result) { resolve(d.result); }
    });
  });
}

async function screenshot(ws, path) {
  return new Promise((resolve) => {
    ws.send(JSON.stringify({ id: Date.now(), method: "Page.captureScreenshot", params: { format: "png" } }));
    ws.on("message", (m) => {
      const d = JSON.parse(m.toString());
      if (d.id && d.result && d.result.data) {
        require("fs").writeFileSync(path, Buffer.from(d.result.data, "base64"));
        resolve();
      }
    });
  });
}

module.exports = { getPage, cdpEval, screenshot };

Format Compatibility

  • CDJ-2000: MP3 or WAV
  • Beatport download options: MP3, WAV, AIFF, FLAC
  • Default is MP3; select WAV/AIFF on cart page or account settings if needed for CDJ compatibility
安全使用建议
This skill appears to do what it says (drive a local headless browser to login and download your purchased Beatport tracks). Before running it: 1) Review the included scripts yourself — they will control your local browser and write files to disk. 2) Note the hard-coded require('/opt/homebrew/.../ws') path: update it to use your environment's ws/openclaw module or install the module locally to avoid surprises. 3) Only provide Beatport credentials on a machine you trust; the script will capture cookies/JWTs (necessary for downloads) and those should be treated as sensitive — consider using a temporary account or rotating your password afterwards. 4) Ensure the openclaw/CDP endpoint (127.0.0.1:9222) is local and not exposed to untrusted networks. 5) If unsure, run the script in an isolated VM or container first to confirm behavior. If you want higher assurance, ask the author to remove absolute paths and document how credentials are supplied and handled.
功能分析
Type: OpenClaw Skill Name: beatport-dl-with-browser-tool Version: 1.0.0 The skill bundle provides a CDP-based automation tool for Beatport downloads with high-risk capabilities. Specifically, the 'scripts/beatport-cdp.js' file includes a 'getCookies' function that can retrieve all browser cookies via 'Network.getAllCookies' and an 'enableDownloads' function that modifies browser-level security settings ('Browser.setDownloadBehavior'). While these features are aligned with the stated purpose of automating music downloads and handling complex authentication, the broad access to sensitive session data and the use of low-level CDP commands for credential handling represent significant security risks.
能力标签
cryptocan-make-purchasesrequires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
Name/description match the included JS and SKILL.md: both implement CDP-driven login, cookie/token capture, and download handling for Beatport. One oddity: the code requires the 'ws' module from a hard-coded absolute path (/opt/homebrew/...), which is macOS/homebrew-specific and fragile — it is related to the skill's use of openclaw but should not be required as an absolute path.
Instruction Scope
SKILL.md and scripts instruct the agent to drive a local headless Chrome via CDP, perform login in-page, capture download tokens and cookies, enable browser downloads, and write downloaded files to a user-specified directory. All actions are within the stated download purpose; the instructions do not ask the agent to read unrelated system files or to transmit captured credentials/tokens to external endpoints.
Install Mechanism
This is an instruction-only skill with a bundled helper script and no install spec or external downloads. Nothing is fetched from arbitrary URLs or installed automatically. Risk from install mechanism is low.
Credentials
The skill requires Beatport credentials to sign in (documented in SKILL.md) but does not declare environment variables for them — this is reasonable for an interactive flow, but you should be aware you'll need to supply username/password. The absolute ws module path is unusual and platform-specific; it implicitly assumes a particular openclaw installation layout and macOS/Homebrew environment.
Persistence & Privilege
The skill is not always-enabled and is user-invocable. It does not request persistent system-wide privileges or attempt to modify other skills. It will write downloads and screenshots to the local filesystem as part of normal operation, which is expected for this purpose.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install beatport-dl-with-browser-tool
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /beatport-dl-with-browser-tool 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: download purchased tracks via headless browser CDP
元数据
Slug beatport-dl-with-browser-tool
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Beatport Download via Browser Tool 是什么?

Download purchased tracks from Beatport using the openclaw headless browser tool (CDP). Handles login, authentication via NextAuth, enabling downloads in hea... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 56 次。

如何安装 Beatport Download via Browser Tool?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install beatport-dl-with-browser-tool」即可一键安装,无需额外配置。

Beatport Download via Browser Tool 是免费的吗?

是的,Beatport Download via Browser Tool 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Beatport Download via Browser Tool 支持哪些平台?

Beatport Download via Browser Tool 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Beatport Download via Browser Tool?

由 esanle(@esanle)开发并维护,当前版本 v1.0.0。

💬 留言讨论