Support PumpYourSound fangates over Bandcamp store links - #100
Conversation
Prefer traditional gates in the track description (e.g. PumpYourSound) when purchase_url points at Bandcamp, and unlock PYS via SoundCloud OAuth plus the fangate downloadLink redirect.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds PumpYourSound URL detection, a Puppeteer-based gate downloader, CLI and server routing, progress and cancellation handling, tests, userscript recognition, and documentation updates. ChangesPumpYourSound support
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant DownloadFlow
participant PumpyoursoundDownloader
participant SoundCloud
participant DirectDownloader
Client->>DownloadFlow: submit PumpYourSound URL
DownloadFlow->>PumpyoursoundDownloader: initialize downloader
PumpyoursoundDownloader->>SoundCloud: complete OAuth and gate steps
SoundCloud-->>PumpyoursoundDownloader: provide completed gate state
PumpyoursoundDownloader->>DirectDownloader: pass resolved download link
DirectDownloader-->>DownloadFlow: return downloaded filename
DownloadFlow-->>Client: report progress and completion
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
DirectDownloader marks progress as browserless, which hid the Web UI cleanup prompt even though the gate already used SoundCloud OAuth.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/pumpyoursound.ts`:
- Around line 45-56: Update initialize() around
loadCookies('soundcloud-cookies.json') to catch failures from missing or
malformed cookie files and report clearly that the user must export the
SoundCloud cookie file before running the downloader. Preserve setting the
cookies through browserContext.setCookie for successfully loaded cookies.
🪄 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: 5366e466-4832-4c8b-9575-cf05ce49c86a
📒 Files selected for processing (9)
README.mdsrc/index.tssrc/pumpyoursound.tssrc/server.tssrc/soundcloud.tssrc/utils.test.tssrc/utils.tsuserscript/sc-gate-dl.user.jswebui/src/components/App.tsx
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/pumpyoursound.ts (2)
277-297: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winFail fast when the comment input is absent.
The code clicks
#fangate-send-commenteven when neither comment-input selector matches. This can submit an empty comment or leave the step incomplete whilecompleteSoundcloudOauthwaits for up to 180 seconds. Require the input before clicking the send control.Proposed fix
const input = document.querySelector<HTMLInputElement>( 'input[name="fangate_comment"], input.fangatex__icomment', ); -if (input) { - input.value = text; - input.dispatchEvent(new Event('input', { bubbles: true })); - input.dispatchEvent(new Event('change', { bubbles: true })); +if (!input) { + throw new Error('PumpYourSound comment input not found.'); } +input.value = text; +input.dispatchEvent(new Event('input', { bubbles: true })); +input.dispatchEvent(new Event('change', { bubbles: true }));🤖 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 `@src/pumpyoursound.ts` around lines 277 - 297, Update the page.evaluate comment-submission flow to throw immediately when no comment input matches either selector, before modifying or clicking `#fangate-send-comment`. Only proceed with setting the input value, updating the send link, and clicking the control when the input exists.
173-179: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winImplement Twitter completion before declaring it supported.
needSocialtreatshandleSocialMarkCompletehas no Twitter selector. The cleanup loop also does not closetwitter.compages. A Twitter gate therefore reaches this branch, returnsfalse, and throws at Lines 200-205. Add the actual Twitter completion selector and popup cleanup, or removeAlso applies to: 440-448, 480-483
🤖 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 `@src/pumpyoursound.ts` around lines 173 - 179, Implement Twitter support consistently across the social flow: add a Twitter completion selector to handleSocialMarkComplete, and include twitter.com pages in the popup cleanup loop. Ensure Twitter gates can complete successfully instead of reaching the unsupported failure branch; otherwise remove twitter from the supported-kind checks in needSocial and the corresponding logic at the additional locations.
🤖 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.
Outside diff comments:
In `@src/pumpyoursound.ts`:
- Around line 277-297: Update the page.evaluate comment-submission flow to throw
immediately when no comment input matches either selector, before modifying or
clicking `#fangate-send-comment`. Only proceed with setting the input value,
updating the send link, and clicking the control when the input exists.
- Around line 173-179: Implement Twitter support consistently across the social
flow: add a Twitter completion selector to handleSocialMarkComplete, and include
twitter.com pages in the popup cleanup loop. Ensure Twitter gates can complete
successfully instead of reaching the unsupported failure branch; otherwise
remove twitter from the supported-kind checks in needSocial and the
corresponding logic at the additional locations.
…social Avoid clicking send without a comment field, and surface Twitter fangate steps as unsupported until mark-complete selectors exist.
|
Addressed CodeRabbit’s outside-diff notes on
|
Summary
downloadLinkvia DirectDownloader)Test plan
./downloads(Drive/direct link after fangate unlock)bun test src/utils.test.tsSummary by CodeRabbit