Skip to content

Prefer authenticated SoundCloud original downloads - #95

Merged
D3SOX merged 2 commits into
masterfrom
soundcloud-original-download
Aug 5, 2026
Merged

Prefer authenticated SoundCloud original downloads#95
D3SOX merged 2 commits into
masterfrom
soundcloud-original-download

Conversation

@D3SOX

@D3SOX D3SOX commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • detect tracks with creator-enabled SoundCloud downloads before resolving gates
  • verify that yt-dlp can access the authenticated download format with exported SoundCloud cookies
  • download directly only when that preflight succeeds; otherwise retain the normal gate fallback
  • show a persistent, dismissible warning when the original download exists but cookies cannot access it

Root cause

Job creation only inspected gate URLs. It did not prioritize SoundCloud's creator-enabled original download, and the API availability flags alone could not prove that the local yt-dlp session had usable authentication cookies.

Impact

Eligible tracks now skip unnecessary gates and use SoundCloud's original upload. Missing, expired, or rejected cookies no longer cause an incorrect direct-download decision, and the UI explains why the app is falling back to the gate.

Validation

  • bun test — 62 tests passed
  • bun run lint
  • bunx tsc --noEmit -p webui/tsconfig.json
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Added support for downloading SoundCloud tracks directly when creator-enabled downloads are available.
    • Job status now identifies creator-enabled downloads as ready.
  • Bug Fixes

    • Added fallback handling when direct downloads cannot be accessed.
    • Added clearer warnings when creator access is available but cookies prevent the download.
  • UI Improvements

    • Added a dismissible warning banner for job creation issues.
    • Warnings are cleared when starting or resetting a job.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 011ae3cf-5d92-4c41-a885-f44f57ea4d42

📥 Commits

Reviewing files that changed from the base of the PR and between b09cbbf and e0e55f2.

📒 Files selected for processing (2)
  • src/ytdlp.ts
  • webui/src/components/App.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • webui/src/components/App.tsx
  • src/ytdlp.ts

📝 Walkthrough

Walkthrough

SoundCloud creator-enabled downloads now use direct downloading when yt-dlp confirms access. Otherwise, job creation keeps the existing gate flow and returns a cookie warning. The web UI displays and dismisses this warning.

Changes

SoundCloud creator downloads

Layer / File(s) Summary
Download eligibility and access checks
src/soundcloudDownload.ts, src/soundcloudDownload.test.ts, src/ytdlp.ts, src/ytdlp.test.ts
Adds SoundCloud eligibility checks and yt-dlp verification for the original download format. Tests cover eligibility and missing-cookie failures.
Job creation routing
src/server.ts
Selects direct SoundCloud downloading when creator access and yt-dlp access are available. It returns download status and a cookie-related warning when access fails.
Job warning presentation
webui/src/components/App.tsx, webui/src/components/App.css
Stores, displays, dismisses, and resets job warnings. Adds warning-banner styling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Server
  participant SoundCloud
  participant Ytdlp
  participant WebUI
  Client->>Server: Create download job
  Server->>SoundCloud: Check creator download availability
  Server->>Ytdlp: Verify original-download access
  Ytdlp-->>Server: Return access result
  Server-->>Client: Return job status and warning
  Client->>WebUI: Render job response
  WebUI-->>Client: Display or dismiss warning
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: using authenticated SoundCloud original downloads when available.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch soundcloud-original-download

Comment @coderabbitai help to get the list of available commands.

@D3SOX
D3SOX marked this pull request as ready for review August 5, 2026 10:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
webui/src/components/App.tsx (1)

610-612: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clear warning before a replacement job request.

Line 611 clears error but retains the previous job warning. The warning remains visible during the request and after a failed replacement request. Set warning to null in this update.

Proposed fix
-			setJob((prev) => ({ ...prev, error: null }));
+			setJob((prev) => ({ ...prev, warning: null, error: null }));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@webui/src/components/App.tsx` around lines 610 - 612, Update the job state
reset alongside setIsLoading and setJob so the replacement request clears both
error and warning. In the setJob updater, set the existing warning field to null
while preserving all other previous job fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/ytdlp.ts`:
- Line 214: Replace both rm calls in the temporary cookie cleanup flow with
Bun.file(cookiesPath).delete(). Preserve force behavior by catching and ignoring
only ENOENT errors, while propagating all other deletion failures.

---

Outside diff comments:
In `@webui/src/components/App.tsx`:
- Around line 610-612: Update the job state reset alongside setIsLoading and
setJob so the replacement request clears both error and warning. In the setJob
updater, set the existing warning field to null while preserving all other
previous job fields.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bd4e3200-1455-4c2b-9a1a-70ba637e80d5

📥 Commits

Reviewing files that changed from the base of the PR and between a0e0df4 and b09cbbf.

📒 Files selected for processing (7)
  • src/server.ts
  • src/soundcloudDownload.test.ts
  • src/soundcloudDownload.ts
  • src/ytdlp.test.ts
  • src/ytdlp.ts
  • webui/src/components/App.css
  • webui/src/components/App.tsx

Comment thread src/ytdlp.ts Outdated
@D3SOX
D3SOX merged commit bd0858c into master Aug 5, 2026
2 checks passed
@D3SOX
D3SOX deleted the soundcloud-original-download branch August 5, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant